nuxt-ui-elements 0.1.3 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "nuxt-ui-elements",
3
3
  "configKey": "uiElements",
4
- "version": "0.1.3",
4
+ "version": "0.1.4",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "3.6.1"
@@ -35,41 +35,68 @@ export interface FlickeringGridProps {
35
35
  * - Tailwind colors: 'blue-500', 'red-600', 'slate-200', etc.
36
36
  * - Direct values: '#3b82f6', 'oklch(0.6 0.15 250)', 'rgb(59, 130, 246)'
37
37
  *
38
- * Choose lighter shades (e.g., 'blue-200') for subtle backgrounds or darker shades (e.g., 'blue-600') for bolder effects.
38
+ * This controls the base hue/color of the grid. Use `lightness` to adjust how bright/washed out it appears.
39
39
  *
40
40
  * @example 'primary' - Nuxt UI semantic color
41
- * @example 'blue-200' - Light Tailwind color for subtle effect
42
- * @example 'blue-600' - Dark Tailwind color for bold effect
43
- * @example '#e0f2fe' - Direct hex color value (light blue)
41
+ * @example 'blue-500' - Tailwind color
42
+ * @example '#3b82f6' - Direct hex color value
44
43
  *
45
44
  * @default 'neutral'
46
45
  */
47
46
  color?: ColorInput;
48
47
  /**
49
- * Opacity/visibility of the grid squares.
50
- * Controls how transparent the grid appears.
48
+ * Lightness adjustment in OKLCH color space (0-100).
51
49
  *
52
- * - 0: Completely invisible
53
- * - 0.3: Subtle, background texture
54
- * - 0.5: Medium visibility
55
- * - 0.8: Bold, prominent
56
- * - 1: Fully opaque
50
+ * Controls how bright or washed-out the color appears WITHOUT changing transparency.
51
+ * This modifies the color itself, making it closer to white (higher values) or more saturated (lower values).
57
52
  *
58
- * Range: 0-1
53
+ * Think of it as a "color brightness" slider:
54
+ * - Lower values (70-80): Darker, more saturated, vibrant colors
55
+ * - Medium values (85-92): Balanced, natural colors
56
+ * - Higher values (93-100): Very light, pastel, washed-out colors (approaching white)
59
57
  *
60
- * @default 0.5
58
+ * Use cases:
59
+ * - Subtle background: `color="blue-500" lightness={95}` → Very light blue tint
60
+ * - Bold accent: `color="blue-500" lightness={75}` → Vibrant, saturated blue
61
+ * - Combined with opacity: `lightness={90} opacity={0.3}` → Medium-tone color, very transparent
62
+ *
63
+ * Range: 0-100
64
+ * @default 95
65
+ */
66
+ lightness?: number;
67
+ /**
68
+ * Opacity/transparency of the grid squares (0-100).
69
+ *
70
+ * Controls how see-through the grid is WITHOUT changing the color itself.
71
+ * This is pure transparency - the color stays the same, just more/less visible.
72
+ *
73
+ * Think of it as a "visibility" slider:
74
+ * - 0: Completely invisible (transparent)
75
+ * - 30: Very subtle, barely visible
76
+ * - 50: Medium visibility
77
+ * - 80: Bold, prominent
78
+ * - 100: Fully opaque, no transparency
79
+ *
80
+ * Use cases:
81
+ * - Gentle texture: `opacity={20}` → Barely visible background pattern
82
+ * - Strong effect: `opacity={80}` → Prominent, eye-catching grid
83
+ * - Combined with lightness: `lightness={95} opacity={50}` → Light color, medium transparency
84
+ *
85
+ * Range: 0-100
86
+ * @default 50
61
87
  */
62
88
  opacity?: number;
63
89
  /**
64
- * Dark mode overrides for color and opacity.
90
+ * Dark mode overrides for color, lightness, and opacity.
65
91
  *
66
92
  * Allows you to customize the grid appearance specifically for dark mode.
67
93
  * Any property not specified will use the default light mode value.
68
94
  *
69
- * @example { color: 'blue-300', opacity: 0.3 }
95
+ * @example { color: 'blue-300', lightness: 90, opacity: 0.3 }
70
96
  */
71
97
  dark?: {
72
98
  color?: ColorInput;
99
+ lightness?: number;
73
100
  opacity?: number;
74
101
  };
75
102
  /**
@@ -7,7 +7,7 @@ import { ref, computed, onMounted, onBeforeUnmount, watch } from "vue";
7
7
  import { useColorMode } from "#imports";
8
8
  import { tv } from "../../utils/tv";
9
9
  import theme from "../../themes/background-flickering-grid";
10
- import { darkenColor, oklchToRgb } from "../../composables/useThemeColors";
10
+ import { adjustLightness, darkenColor, oklchToRgb } from "../../composables/useThemeColors";
11
11
  import {
12
12
  resolveColor
13
13
  } from "../../composables/useColorResolver";
@@ -16,7 +16,8 @@ const {
16
16
  gap = 9,
17
17
  speed = 5,
18
18
  color = "neutral",
19
- opacity = 0.5,
19
+ lightness = 95,
20
+ opacity = 50,
20
21
  ...props
21
22
  } = defineProps({
22
23
  size: { type: Number, required: false },
@@ -24,6 +25,7 @@ const {
24
25
  speed: { type: Number, required: false },
25
26
  fade: { type: String, required: false },
26
27
  color: { type: null, required: false },
28
+ lightness: { type: Number, required: false },
27
29
  opacity: { type: Number, required: false },
28
30
  dark: { type: Object, required: false },
29
31
  ui: { type: null, required: false }
@@ -36,11 +38,15 @@ const effectiveColor = computed(() => {
36
38
  }
37
39
  return color;
38
40
  });
39
- const effectiveOpacity = computed(() => {
40
- if (isDark.value && props.dark?.opacity !== void 0) {
41
- return props.dark.opacity;
41
+ const effectiveLightness = computed(() => {
42
+ if (isDark.value && props.dark?.lightness !== void 0) {
43
+ return props.dark.lightness;
42
44
  }
43
- return opacity;
45
+ return lightness;
46
+ });
47
+ const effectiveOpacity = computed(() => {
48
+ const opacityValue = isDark.value && props.dark?.opacity !== void 0 ? props.dark.opacity : opacity;
49
+ return opacityValue / 100;
44
50
  });
45
51
  const internalSpeed = computed(() => {
46
52
  return speed * 0.01;
@@ -88,8 +94,9 @@ function parseColor(color2) {
88
94
  }
89
95
  const gridColors = computed(() => {
90
96
  const baseColor = resolveColor(effectiveColor.value);
91
- const baseRgb = oklchToRgb(baseColor);
92
- const darkerColor = darkenColor(baseColor, 10);
97
+ const adjustedColor = adjustLightness(baseColor, effectiveLightness.value);
98
+ const baseRgb = oklchToRgb(adjustedColor);
99
+ const darkerColor = darkenColor(adjustedColor, 10);
93
100
  const flickerRgb = oklchToRgb(darkerColor);
94
101
  return {
95
102
  base: parseColor(baseRgb),
@@ -218,8 +225,10 @@ watch(
218
225
  () => size,
219
226
  () => gap,
220
227
  () => color,
228
+ () => lightness,
221
229
  () => opacity,
222
230
  () => props.dark?.color,
231
+ () => props.dark?.lightness,
223
232
  () => props.dark?.opacity
224
233
  ],
225
234
  () => {
@@ -35,41 +35,68 @@ export interface FlickeringGridProps {
35
35
  * - Tailwind colors: 'blue-500', 'red-600', 'slate-200', etc.
36
36
  * - Direct values: '#3b82f6', 'oklch(0.6 0.15 250)', 'rgb(59, 130, 246)'
37
37
  *
38
- * Choose lighter shades (e.g., 'blue-200') for subtle backgrounds or darker shades (e.g., 'blue-600') for bolder effects.
38
+ * This controls the base hue/color of the grid. Use `lightness` to adjust how bright/washed out it appears.
39
39
  *
40
40
  * @example 'primary' - Nuxt UI semantic color
41
- * @example 'blue-200' - Light Tailwind color for subtle effect
42
- * @example 'blue-600' - Dark Tailwind color for bold effect
43
- * @example '#e0f2fe' - Direct hex color value (light blue)
41
+ * @example 'blue-500' - Tailwind color
42
+ * @example '#3b82f6' - Direct hex color value
44
43
  *
45
44
  * @default 'neutral'
46
45
  */
47
46
  color?: ColorInput;
48
47
  /**
49
- * Opacity/visibility of the grid squares.
50
- * Controls how transparent the grid appears.
48
+ * Lightness adjustment in OKLCH color space (0-100).
51
49
  *
52
- * - 0: Completely invisible
53
- * - 0.3: Subtle, background texture
54
- * - 0.5: Medium visibility
55
- * - 0.8: Bold, prominent
56
- * - 1: Fully opaque
50
+ * Controls how bright or washed-out the color appears WITHOUT changing transparency.
51
+ * This modifies the color itself, making it closer to white (higher values) or more saturated (lower values).
57
52
  *
58
- * Range: 0-1
53
+ * Think of it as a "color brightness" slider:
54
+ * - Lower values (70-80): Darker, more saturated, vibrant colors
55
+ * - Medium values (85-92): Balanced, natural colors
56
+ * - Higher values (93-100): Very light, pastel, washed-out colors (approaching white)
59
57
  *
60
- * @default 0.5
58
+ * Use cases:
59
+ * - Subtle background: `color="blue-500" lightness={95}` → Very light blue tint
60
+ * - Bold accent: `color="blue-500" lightness={75}` → Vibrant, saturated blue
61
+ * - Combined with opacity: `lightness={90} opacity={0.3}` → Medium-tone color, very transparent
62
+ *
63
+ * Range: 0-100
64
+ * @default 95
65
+ */
66
+ lightness?: number;
67
+ /**
68
+ * Opacity/transparency of the grid squares (0-100).
69
+ *
70
+ * Controls how see-through the grid is WITHOUT changing the color itself.
71
+ * This is pure transparency - the color stays the same, just more/less visible.
72
+ *
73
+ * Think of it as a "visibility" slider:
74
+ * - 0: Completely invisible (transparent)
75
+ * - 30: Very subtle, barely visible
76
+ * - 50: Medium visibility
77
+ * - 80: Bold, prominent
78
+ * - 100: Fully opaque, no transparency
79
+ *
80
+ * Use cases:
81
+ * - Gentle texture: `opacity={20}` → Barely visible background pattern
82
+ * - Strong effect: `opacity={80}` → Prominent, eye-catching grid
83
+ * - Combined with lightness: `lightness={95} opacity={50}` → Light color, medium transparency
84
+ *
85
+ * Range: 0-100
86
+ * @default 50
61
87
  */
62
88
  opacity?: number;
63
89
  /**
64
- * Dark mode overrides for color and opacity.
90
+ * Dark mode overrides for color, lightness, and opacity.
65
91
  *
66
92
  * Allows you to customize the grid appearance specifically for dark mode.
67
93
  * Any property not specified will use the default light mode value.
68
94
  *
69
- * @example { color: 'blue-300', opacity: 0.3 }
95
+ * @example { color: 'blue-300', lightness: 90, opacity: 0.3 }
70
96
  */
71
97
  dark?: {
72
98
  color?: ColorInput;
99
+ lightness?: number;
73
100
  opacity?: number;
74
101
  };
75
102
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nuxt-ui-elements",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "A collection of beautiful, animated UI components for Nuxt applications",
5
5
  "license": "MIT",
6
6
  "repository": "https://github.com/genu/nuxt-ui-elements.git",