@yamada-ui/utils 0.1.5 → 0.2.0
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/{chunk-XIDDMDVR.mjs → chunk-32BEUAHK.mjs} +7 -7
- package/dist/color.d.mts +10 -10
- package/dist/color.d.ts +10 -10
- package/dist/color.js +7 -7
- package/dist/color.mjs +1 -1
- package/dist/function.mjs +1 -1
- package/dist/index.js +7 -7
- package/dist/index.mjs +1 -1
- package/dist/object.mjs +1 -1
- package/dist/react.mjs +1 -1
- package/package.json +1 -1
|
@@ -195,27 +195,27 @@ var getColor = (color, fallback) => (theme, colorMode) => {
|
|
|
195
195
|
}
|
|
196
196
|
};
|
|
197
197
|
var lightenColor = (color, amount) => (theme, colorMode) => {
|
|
198
|
-
const raw = getColor(color)(theme, colorMode);
|
|
198
|
+
const raw = theme ? getColor(color)(theme, colorMode) : color;
|
|
199
199
|
return toHex(lighten(raw, amount / 100));
|
|
200
200
|
};
|
|
201
201
|
var darkenColor = (color, amount) => (theme, colorMode) => {
|
|
202
|
-
const raw = getColor(color)(theme, colorMode);
|
|
202
|
+
const raw = theme ? getColor(color)(theme, colorMode) : color;
|
|
203
203
|
return toHex(darken(raw, amount / 100));
|
|
204
204
|
};
|
|
205
205
|
var tintColor = (color, amount) => (theme, colorMode) => {
|
|
206
|
-
const raw = getColor(color)(theme, colorMode);
|
|
206
|
+
const raw = theme ? getColor(color)(theme, colorMode) : color;
|
|
207
207
|
return toHex(mix(raw, "#fff", amount));
|
|
208
208
|
};
|
|
209
209
|
var shadeColor = (color, amount) => (theme, colorMode) => {
|
|
210
|
-
const raw = getColor(color)(theme, colorMode);
|
|
210
|
+
const raw = theme ? getColor(color)(theme, colorMode) : color;
|
|
211
211
|
return toHex(mix(raw, "#000", amount / 100));
|
|
212
212
|
};
|
|
213
213
|
var transparentizeColor = (color, alpha) => (theme, colorMode) => {
|
|
214
|
-
const raw = getColor(color)(theme, colorMode);
|
|
214
|
+
const raw = theme ? getColor(color)(theme, colorMode) : color;
|
|
215
215
|
return transparentize(raw, 1 - alpha);
|
|
216
216
|
};
|
|
217
217
|
var toneColor = (color, l) => (theme, colorMode) => {
|
|
218
|
-
const raw = getColor(color)(theme, colorMode);
|
|
218
|
+
const raw = theme ? getColor(color)(theme, colorMode) : color;
|
|
219
219
|
if (l < 0 || 900 < l)
|
|
220
220
|
return color;
|
|
221
221
|
let n = (l - 500) / 10;
|
|
@@ -272,7 +272,7 @@ var getBrightness = (color) => {
|
|
|
272
272
|
return (r * 299 + g * 587 + b * 114) / 1e3;
|
|
273
273
|
};
|
|
274
274
|
var isTone = (color) => (theme, colorMode) => {
|
|
275
|
-
const raw = getColor(color)(theme, colorMode);
|
|
275
|
+
const raw = theme ? getColor(color)(theme, colorMode) : color;
|
|
276
276
|
const brightness = getBrightness(raw);
|
|
277
277
|
const isDark2 = brightness < 128;
|
|
278
278
|
return isDark2 ? "dark" : "light";
|
package/dist/color.d.mts
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { Dict } from './index.types.mjs';
|
|
2
2
|
|
|
3
3
|
declare const isGray: (colorScheme: string) => boolean;
|
|
4
|
-
declare const getColor: (color: string, fallback?: string) => (theme: Dict, colorMode
|
|
5
|
-
declare const lightenColor: (color: string, amount: number) => (theme
|
|
6
|
-
declare const darkenColor: (color: string, amount: number) => (theme
|
|
7
|
-
declare const tintColor: (color: string, amount: number) => (theme
|
|
8
|
-
declare const shadeColor: (color: string, amount: number) => (theme
|
|
9
|
-
declare const transparentizeColor: (color: string, alpha: number) => (theme
|
|
10
|
-
declare const toneColor: (color: string, l: number) => (theme
|
|
4
|
+
declare const getColor: (color: string, fallback?: string) => (theme: Dict, colorMode?: 'light' | 'dark') => string;
|
|
5
|
+
declare const lightenColor: (color: string, amount: number) => (theme?: Dict, colorMode?: 'light' | 'dark') => string;
|
|
6
|
+
declare const darkenColor: (color: string, amount: number) => (theme?: Dict, colorMode?: 'light' | 'dark') => string;
|
|
7
|
+
declare const tintColor: (color: string, amount: number) => (theme?: Dict, colorMode?: 'light' | 'dark') => string;
|
|
8
|
+
declare const shadeColor: (color: string, amount: number) => (theme?: Dict, colorMode?: 'light' | 'dark') => string;
|
|
9
|
+
declare const transparentizeColor: (color: string, alpha: number) => (theme?: Dict, colorMode?: 'light' | 'dark') => string;
|
|
10
|
+
declare const toneColor: (color: string, l: number) => (theme?: Dict, colorMode?: 'light' | 'dark') => string;
|
|
11
11
|
declare const randomColor: ({ string, colors, }?: {
|
|
12
12
|
string?: string | undefined;
|
|
13
13
|
colors?: string[] | undefined;
|
|
14
14
|
}) => string;
|
|
15
|
-
declare const isTone: (color: string) => (theme
|
|
16
|
-
declare const isLight: (color: string) => (theme
|
|
17
|
-
declare const isDark: (color: string) => (theme
|
|
15
|
+
declare const isTone: (color: string) => (theme?: Dict, colorMode?: 'light' | 'dark') => "light" | "dark";
|
|
16
|
+
declare const isLight: (color: string) => (theme?: Dict, colorMode?: 'light' | 'dark') => boolean;
|
|
17
|
+
declare const isDark: (color: string) => (theme?: Dict, colorMode?: 'light' | 'dark') => boolean;
|
|
18
18
|
|
|
19
19
|
export { darkenColor, getColor, isDark, isGray, isLight, isTone, lightenColor, randomColor, shadeColor, tintColor, toneColor, transparentizeColor };
|
package/dist/color.d.ts
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { Dict } from './index.types.js';
|
|
2
2
|
|
|
3
3
|
declare const isGray: (colorScheme: string) => boolean;
|
|
4
|
-
declare const getColor: (color: string, fallback?: string) => (theme: Dict, colorMode
|
|
5
|
-
declare const lightenColor: (color: string, amount: number) => (theme
|
|
6
|
-
declare const darkenColor: (color: string, amount: number) => (theme
|
|
7
|
-
declare const tintColor: (color: string, amount: number) => (theme
|
|
8
|
-
declare const shadeColor: (color: string, amount: number) => (theme
|
|
9
|
-
declare const transparentizeColor: (color: string, alpha: number) => (theme
|
|
10
|
-
declare const toneColor: (color: string, l: number) => (theme
|
|
4
|
+
declare const getColor: (color: string, fallback?: string) => (theme: Dict, colorMode?: 'light' | 'dark') => string;
|
|
5
|
+
declare const lightenColor: (color: string, amount: number) => (theme?: Dict, colorMode?: 'light' | 'dark') => string;
|
|
6
|
+
declare const darkenColor: (color: string, amount: number) => (theme?: Dict, colorMode?: 'light' | 'dark') => string;
|
|
7
|
+
declare const tintColor: (color: string, amount: number) => (theme?: Dict, colorMode?: 'light' | 'dark') => string;
|
|
8
|
+
declare const shadeColor: (color: string, amount: number) => (theme?: Dict, colorMode?: 'light' | 'dark') => string;
|
|
9
|
+
declare const transparentizeColor: (color: string, alpha: number) => (theme?: Dict, colorMode?: 'light' | 'dark') => string;
|
|
10
|
+
declare const toneColor: (color: string, l: number) => (theme?: Dict, colorMode?: 'light' | 'dark') => string;
|
|
11
11
|
declare const randomColor: ({ string, colors, }?: {
|
|
12
12
|
string?: string | undefined;
|
|
13
13
|
colors?: string[] | undefined;
|
|
14
14
|
}) => string;
|
|
15
|
-
declare const isTone: (color: string) => (theme
|
|
16
|
-
declare const isLight: (color: string) => (theme
|
|
17
|
-
declare const isDark: (color: string) => (theme
|
|
15
|
+
declare const isTone: (color: string) => (theme?: Dict, colorMode?: 'light' | 'dark') => "light" | "dark";
|
|
16
|
+
declare const isLight: (color: string) => (theme?: Dict, colorMode?: 'light' | 'dark') => boolean;
|
|
17
|
+
declare const isDark: (color: string) => (theme?: Dict, colorMode?: 'light' | 'dark') => boolean;
|
|
18
18
|
|
|
19
19
|
export { darkenColor, getColor, isDark, isGray, isLight, isTone, lightenColor, randomColor, shadeColor, tintColor, toneColor, transparentizeColor };
|
package/dist/color.js
CHANGED
|
@@ -84,27 +84,27 @@ var getColor = (color, fallback) => (theme, colorMode) => {
|
|
|
84
84
|
}
|
|
85
85
|
};
|
|
86
86
|
var lightenColor = (color, amount) => (theme, colorMode) => {
|
|
87
|
-
const raw = getColor(color)(theme, colorMode);
|
|
87
|
+
const raw = theme ? getColor(color)(theme, colorMode) : color;
|
|
88
88
|
return (0, import_color2k.toHex)((0, import_color2k.lighten)(raw, amount / 100));
|
|
89
89
|
};
|
|
90
90
|
var darkenColor = (color, amount) => (theme, colorMode) => {
|
|
91
|
-
const raw = getColor(color)(theme, colorMode);
|
|
91
|
+
const raw = theme ? getColor(color)(theme, colorMode) : color;
|
|
92
92
|
return (0, import_color2k.toHex)((0, import_color2k.darken)(raw, amount / 100));
|
|
93
93
|
};
|
|
94
94
|
var tintColor = (color, amount) => (theme, colorMode) => {
|
|
95
|
-
const raw = getColor(color)(theme, colorMode);
|
|
95
|
+
const raw = theme ? getColor(color)(theme, colorMode) : color;
|
|
96
96
|
return (0, import_color2k.toHex)((0, import_color2k.mix)(raw, "#fff", amount));
|
|
97
97
|
};
|
|
98
98
|
var shadeColor = (color, amount) => (theme, colorMode) => {
|
|
99
|
-
const raw = getColor(color)(theme, colorMode);
|
|
99
|
+
const raw = theme ? getColor(color)(theme, colorMode) : color;
|
|
100
100
|
return (0, import_color2k.toHex)((0, import_color2k.mix)(raw, "#000", amount / 100));
|
|
101
101
|
};
|
|
102
102
|
var transparentizeColor = (color, alpha) => (theme, colorMode) => {
|
|
103
|
-
const raw = getColor(color)(theme, colorMode);
|
|
103
|
+
const raw = theme ? getColor(color)(theme, colorMode) : color;
|
|
104
104
|
return (0, import_color2k.transparentize)(raw, 1 - alpha);
|
|
105
105
|
};
|
|
106
106
|
var toneColor = (color, l) => (theme, colorMode) => {
|
|
107
|
-
const raw = getColor(color)(theme, colorMode);
|
|
107
|
+
const raw = theme ? getColor(color)(theme, colorMode) : color;
|
|
108
108
|
if (l < 0 || 900 < l)
|
|
109
109
|
return color;
|
|
110
110
|
let n = (l - 500) / 10;
|
|
@@ -161,7 +161,7 @@ var getBrightness = (color) => {
|
|
|
161
161
|
return (r * 299 + g * 587 + b * 114) / 1e3;
|
|
162
162
|
};
|
|
163
163
|
var isTone = (color) => (theme, colorMode) => {
|
|
164
|
-
const raw = getColor(color)(theme, colorMode);
|
|
164
|
+
const raw = theme ? getColor(color)(theme, colorMode) : color;
|
|
165
165
|
const brightness = getBrightness(raw);
|
|
166
166
|
const isDark2 = brightness < 128;
|
|
167
167
|
return isDark2 ? "dark" : "light";
|
package/dist/color.mjs
CHANGED
package/dist/function.mjs
CHANGED
package/dist/index.js
CHANGED
|
@@ -594,27 +594,27 @@ var getColor = (color, fallback) => (theme, colorMode) => {
|
|
|
594
594
|
}
|
|
595
595
|
};
|
|
596
596
|
var lightenColor = (color, amount) => (theme, colorMode) => {
|
|
597
|
-
const raw = getColor(color)(theme, colorMode);
|
|
597
|
+
const raw = theme ? getColor(color)(theme, colorMode) : color;
|
|
598
598
|
return (0, import_color2k.toHex)((0, import_color2k.lighten)(raw, amount / 100));
|
|
599
599
|
};
|
|
600
600
|
var darkenColor = (color, amount) => (theme, colorMode) => {
|
|
601
|
-
const raw = getColor(color)(theme, colorMode);
|
|
601
|
+
const raw = theme ? getColor(color)(theme, colorMode) : color;
|
|
602
602
|
return (0, import_color2k.toHex)((0, import_color2k.darken)(raw, amount / 100));
|
|
603
603
|
};
|
|
604
604
|
var tintColor = (color, amount) => (theme, colorMode) => {
|
|
605
|
-
const raw = getColor(color)(theme, colorMode);
|
|
605
|
+
const raw = theme ? getColor(color)(theme, colorMode) : color;
|
|
606
606
|
return (0, import_color2k.toHex)((0, import_color2k.mix)(raw, "#fff", amount));
|
|
607
607
|
};
|
|
608
608
|
var shadeColor = (color, amount) => (theme, colorMode) => {
|
|
609
|
-
const raw = getColor(color)(theme, colorMode);
|
|
609
|
+
const raw = theme ? getColor(color)(theme, colorMode) : color;
|
|
610
610
|
return (0, import_color2k.toHex)((0, import_color2k.mix)(raw, "#000", amount / 100));
|
|
611
611
|
};
|
|
612
612
|
var transparentizeColor = (color, alpha) => (theme, colorMode) => {
|
|
613
|
-
const raw = getColor(color)(theme, colorMode);
|
|
613
|
+
const raw = theme ? getColor(color)(theme, colorMode) : color;
|
|
614
614
|
return (0, import_color2k.transparentize)(raw, 1 - alpha);
|
|
615
615
|
};
|
|
616
616
|
var toneColor = (color, l) => (theme, colorMode) => {
|
|
617
|
-
const raw = getColor(color)(theme, colorMode);
|
|
617
|
+
const raw = theme ? getColor(color)(theme, colorMode) : color;
|
|
618
618
|
if (l < 0 || 900 < l)
|
|
619
619
|
return color;
|
|
620
620
|
let n = (l - 500) / 10;
|
|
@@ -671,7 +671,7 @@ var getBrightness = (color) => {
|
|
|
671
671
|
return (r * 299 + g * 587 + b * 114) / 1e3;
|
|
672
672
|
};
|
|
673
673
|
var isTone = (color) => (theme, colorMode) => {
|
|
674
|
-
const raw = getColor(color)(theme, colorMode);
|
|
674
|
+
const raw = theme ? getColor(color)(theme, colorMode) : color;
|
|
675
675
|
const brightness = getBrightness(raw);
|
|
676
676
|
const isDark2 = brightness < 128;
|
|
677
677
|
return isDark2 ? "dark" : "light";
|
package/dist/index.mjs
CHANGED
package/dist/object.mjs
CHANGED
package/dist/react.mjs
CHANGED