@zag-js/color-utils 2.0.0-next.2 → 2.0.0-next.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/_virtual/_@oxc-project_runtime@0.158.0/helpers/esm/defineProperty.js +11 -0
- package/dist/_virtual/_@oxc-project_runtime@0.158.0/helpers/esm/defineProperty.mjs +11 -0
- package/dist/_virtual/_@oxc-project_runtime@0.158.0/helpers/esm/toPrimitive.js +13 -0
- package/dist/_virtual/_@oxc-project_runtime@0.158.0/helpers/esm/toPrimitive.mjs +13 -0
- package/dist/_virtual/_@oxc-project_runtime@0.158.0/helpers/esm/toPropertyKey.js +8 -0
- package/dist/_virtual/_@oxc-project_runtime@0.158.0/helpers/esm/toPropertyKey.mjs +8 -0
- package/dist/_virtual/_@oxc-project_runtime@0.158.0/helpers/esm/typeof.js +15 -0
- package/dist/_virtual/_@oxc-project_runtime@0.158.0/helpers/esm/typeof.mjs +10 -0
- package/dist/area-gradient.d.mts +9 -11
- package/dist/area-gradient.d.ts +9 -11
- package/dist/area-gradient.js +58 -89
- package/dist/area-gradient.mjs +54 -77
- package/dist/color-format-gradient.d.mts +76 -78
- package/dist/color-format-gradient.d.ts +76 -78
- package/dist/color-format-gradient.js +118 -185
- package/dist/color-format-gradient.mjs +104 -152
- package/dist/color.d.mts +20 -23
- package/dist/color.d.ts +20 -23
- package/dist/color.js +57 -83
- package/dist/color.mjs +53 -60
- package/dist/gamut.d.mts +2 -5
- package/dist/gamut.d.ts +2 -5
- package/dist/gamut.js +12 -34
- package/dist/gamut.mjs +8 -11
- package/dist/hsb-color.d.mts +37 -40
- package/dist/hsb-color.d.ts +37 -40
- package/dist/hsb-color.js +164 -200
- package/dist/hsb-color.mjs +158 -175
- package/dist/hsl-color.d.mts +33 -36
- package/dist/hsl-color.d.ts +33 -36
- package/dist/hsl-color.js +139 -168
- package/dist/hsl-color.mjs +132 -142
- package/dist/index.d.mts +8 -7
- package/dist/index.d.ts +8 -7
- package/dist/index.js +23 -60
- package/dist/index.mjs +2 -28
- package/dist/native-color.d.mts +1 -3
- package/dist/native-color.d.ts +1 -3
- package/dist/native-color.js +16 -39
- package/dist/native-color.mjs +12 -16
- package/dist/oklab-color.d.mts +57 -60
- package/dist/oklab-color.d.ts +57 -60
- package/dist/oklab-color.js +363 -379
- package/dist/oklab-color.mjs +353 -350
- package/dist/oklab-math.d.mts +26 -28
- package/dist/oklab-math.d.ts +26 -28
- package/dist/oklab-math.js +123 -142
- package/dist/oklab-math.mjs +108 -108
- package/dist/parse-color.d.mts +3 -6
- package/dist/parse-color.d.ts +3 -6
- package/dist/parse-color.js +22 -48
- package/dist/parse-color.mjs +13 -20
- package/dist/rgb-color.d.mts +33 -36
- package/dist/rgb-color.d.ts +33 -36
- package/dist/rgb-color.js +182 -220
- package/dist/rgb-color.mjs +174 -193
- package/dist/types.d.mts +82 -84
- package/dist/types.d.ts +82 -84
- package/dist/types.js +4 -18
- package/dist/types.mjs +1 -0
- package/package.json +3 -3
- package/dist/chunk-QZ7TP4HQ.mjs +0 -7
|
@@ -1,90 +1,88 @@
|
|
|
1
|
-
declare const generateRGB_R: (orientation: [string, string], dir: boolean, zValue: number) => {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
export declare const generateRGB_R: (orientation: [string, string], dir: boolean, zValue: number) => {
|
|
2
|
+
areaStyles: {
|
|
3
|
+
backgroundImage: string;
|
|
4
|
+
};
|
|
5
|
+
areaGradientStyles: {
|
|
6
|
+
backgroundImage: string;
|
|
7
|
+
WebkitMaskImage: string;
|
|
8
|
+
maskImage: string;
|
|
9
|
+
};
|
|
10
10
|
};
|
|
11
|
-
declare const generateRGB_G: (orientation: [string, string], dir: boolean, zValue: number) => {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
11
|
+
export declare const generateRGB_G: (orientation: [string, string], dir: boolean, zValue: number) => {
|
|
12
|
+
areaStyles: {
|
|
13
|
+
backgroundImage: string;
|
|
14
|
+
};
|
|
15
|
+
areaGradientStyles: {
|
|
16
|
+
backgroundImage: string;
|
|
17
|
+
WebkitMaskImage: string;
|
|
18
|
+
maskImage: string;
|
|
19
|
+
};
|
|
20
20
|
};
|
|
21
|
-
declare const generateRGB_B: (orientation: [string, string], dir: boolean, zValue: number) => {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
21
|
+
export declare const generateRGB_B: (orientation: [string, string], dir: boolean, zValue: number) => {
|
|
22
|
+
areaStyles: {
|
|
23
|
+
backgroundImage: string;
|
|
24
|
+
};
|
|
25
|
+
areaGradientStyles: {
|
|
26
|
+
backgroundImage: string;
|
|
27
|
+
WebkitMaskImage: string;
|
|
28
|
+
maskImage: string;
|
|
29
|
+
};
|
|
30
30
|
};
|
|
31
|
-
declare const generateHSL_H: (orientation: [string, string], dir: boolean, zValue: number) => {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
31
|
+
export declare const generateHSL_H: (orientation: [string, string], dir: boolean, zValue: number) => {
|
|
32
|
+
areaStyles: {};
|
|
33
|
+
areaGradientStyles: {
|
|
34
|
+
background: string;
|
|
35
|
+
};
|
|
36
36
|
};
|
|
37
|
-
declare const generateHSL_S: (orientation: [string, string], dir: boolean, alphaValue: number) => {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
37
|
+
export declare const generateHSL_S: (orientation: [string, string], dir: boolean, alphaValue: number) => {
|
|
38
|
+
areaStyles: {};
|
|
39
|
+
areaGradientStyles: {
|
|
40
|
+
background: string;
|
|
41
|
+
};
|
|
42
42
|
};
|
|
43
|
-
declare const generateHSL_L: (orientation: [string, string], dir: boolean, zValue: number) => {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
43
|
+
export declare const generateHSL_L: (orientation: [string, string], dir: boolean, zValue: number) => {
|
|
44
|
+
areaStyles: {};
|
|
45
|
+
areaGradientStyles: {
|
|
46
|
+
backgroundImage: string;
|
|
47
|
+
};
|
|
48
48
|
};
|
|
49
|
-
declare const generateHSB_H: (orientation: [string, string], dir: boolean, zValue: number) => {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
49
|
+
export declare const generateHSB_H: (orientation: [string, string], dir: boolean, zValue: number) => {
|
|
50
|
+
areaStyles: {};
|
|
51
|
+
areaGradientStyles: {
|
|
52
|
+
background: string;
|
|
53
|
+
};
|
|
54
54
|
};
|
|
55
|
-
declare const generateHSB_S: (orientation: [string, string], dir: boolean, alphaValue: number) => {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
55
|
+
export declare const generateHSB_S: (orientation: [string, string], dir: boolean, alphaValue: number) => {
|
|
56
|
+
areaStyles: {};
|
|
57
|
+
areaGradientStyles: {
|
|
58
|
+
background: string;
|
|
59
|
+
};
|
|
60
60
|
};
|
|
61
|
-
declare const generateHSB_B: (orientation: [string, string], dir: boolean, alphaValue: number) => {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
61
|
+
export declare const generateHSB_B: (orientation: [string, string], dir: boolean, alphaValue: number) => {
|
|
62
|
+
areaStyles: {};
|
|
63
|
+
areaGradientStyles: {
|
|
64
|
+
background: string;
|
|
65
|
+
};
|
|
66
66
|
};
|
|
67
67
|
/** oklab: x = a, y = b, z = lightness (fixed L) */
|
|
68
|
-
declare const generateOKLAB_AB: (orientation: [string, string], dir: boolean, L: number) => {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
68
|
+
export declare const generateOKLAB_AB: (orientation: [string, string], dir: boolean, L: number) => {
|
|
69
|
+
areaStyles: {
|
|
70
|
+
background: string;
|
|
71
|
+
};
|
|
72
|
+
areaGradientStyles: {
|
|
73
|
+
background: string;
|
|
74
|
+
maskImage: string;
|
|
75
|
+
WebkitMaskImage: string;
|
|
76
|
+
};
|
|
77
77
|
};
|
|
78
78
|
/** oklch: x = lightness, y = chroma, z = hue (fixed H) */
|
|
79
|
-
declare const generateOKLCH_LC: (orientation: [string, string], dir: boolean, H: number) => {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
export { generateHSB_B, generateHSB_H, generateHSB_S, generateHSL_H, generateHSL_L, generateHSL_S, generateOKLAB_AB, generateOKLCH_LC, generateRGB_B, generateRGB_G, generateRGB_R };
|
|
79
|
+
export declare const generateOKLCH_LC: (orientation: [string, string], dir: boolean, H: number) => {
|
|
80
|
+
areaStyles: {
|
|
81
|
+
background: string;
|
|
82
|
+
};
|
|
83
|
+
areaGradientStyles: {
|
|
84
|
+
background: string;
|
|
85
|
+
maskImage: string;
|
|
86
|
+
WebkitMaskImage: string;
|
|
87
|
+
};
|
|
88
|
+
};
|
|
@@ -1,197 +1,130 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// src/color-format-gradient.ts
|
|
21
|
-
var color_format_gradient_exports = {};
|
|
22
|
-
__export(color_format_gradient_exports, {
|
|
23
|
-
generateHSB_B: () => generateHSB_B,
|
|
24
|
-
generateHSB_H: () => generateHSB_H,
|
|
25
|
-
generateHSB_S: () => generateHSB_S,
|
|
26
|
-
generateHSL_H: () => generateHSL_H,
|
|
27
|
-
generateHSL_L: () => generateHSL_L,
|
|
28
|
-
generateHSL_S: () => generateHSL_S,
|
|
29
|
-
generateOKLAB_AB: () => generateOKLAB_AB,
|
|
30
|
-
generateOKLCH_LC: () => generateOKLCH_LC,
|
|
31
|
-
generateRGB_B: () => generateRGB_B,
|
|
32
|
-
generateRGB_G: () => generateRGB_G,
|
|
33
|
-
generateRGB_R: () => generateRGB_R
|
|
1
|
+
Object.defineProperties(exports, {
|
|
2
|
+
__esModule: { value: true },
|
|
3
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
34
4
|
});
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
return result;
|
|
5
|
+
// src/color-format-gradient.ts
|
|
6
|
+
const generateRGB_R = (orientation, dir, zValue) => {
|
|
7
|
+
const maskImage = `linear-gradient(to ${orientation[Number(!dir)]}, transparent, #000)`;
|
|
8
|
+
return {
|
|
9
|
+
areaStyles: { backgroundImage: `linear-gradient(to ${orientation[Number(dir)]},rgb(${zValue},0,0),rgb(${zValue},255,0))` },
|
|
10
|
+
areaGradientStyles: {
|
|
11
|
+
backgroundImage: `linear-gradient(to ${orientation[Number(dir)]},rgb(${zValue},0,255),rgb(${zValue},255,255))`,
|
|
12
|
+
WebkitMaskImage: maskImage,
|
|
13
|
+
maskImage
|
|
14
|
+
}
|
|
15
|
+
};
|
|
49
16
|
};
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}
|
|
61
|
-
};
|
|
62
|
-
return result;
|
|
17
|
+
const generateRGB_G = (orientation, dir, zValue) => {
|
|
18
|
+
const maskImage = `linear-gradient(to ${orientation[Number(!dir)]}, transparent, #000)`;
|
|
19
|
+
return {
|
|
20
|
+
areaStyles: { backgroundImage: `linear-gradient(to ${orientation[Number(dir)]},rgb(0,${zValue},0),rgb(255,${zValue},0))` },
|
|
21
|
+
areaGradientStyles: {
|
|
22
|
+
backgroundImage: `linear-gradient(to ${orientation[Number(dir)]},rgb(0,${zValue},255),rgb(255,${zValue},255))`,
|
|
23
|
+
WebkitMaskImage: maskImage,
|
|
24
|
+
maskImage
|
|
25
|
+
}
|
|
26
|
+
};
|
|
63
27
|
};
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
}
|
|
75
|
-
};
|
|
76
|
-
return result;
|
|
28
|
+
const generateRGB_B = (orientation, dir, zValue) => {
|
|
29
|
+
const maskImage = `linear-gradient(to ${orientation[Number(!dir)]}, transparent, #000)`;
|
|
30
|
+
return {
|
|
31
|
+
areaStyles: { backgroundImage: `linear-gradient(to ${orientation[Number(dir)]},rgb(0,0,${zValue}),rgb(255,0,${zValue}))` },
|
|
32
|
+
areaGradientStyles: {
|
|
33
|
+
backgroundImage: `linear-gradient(to ${orientation[Number(dir)]},rgb(0,255,${zValue}),rgb(255,255,${zValue}))`,
|
|
34
|
+
WebkitMaskImage: maskImage,
|
|
35
|
+
maskImage
|
|
36
|
+
}
|
|
37
|
+
};
|
|
77
38
|
};
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
}
|
|
88
|
-
};
|
|
89
|
-
return result;
|
|
39
|
+
const generateHSL_H = (orientation, dir, zValue) => {
|
|
40
|
+
return {
|
|
41
|
+
areaStyles: {},
|
|
42
|
+
areaGradientStyles: { background: [
|
|
43
|
+
`linear-gradient(to ${orientation[Number(dir)]}, hsla(0,0%,0%,1) 0%, hsla(0,0%,0%,0) 50%, hsla(0,0%,100%,0) 50%, hsla(0,0%,100%,1) 100%)`,
|
|
44
|
+
`linear-gradient(to ${orientation[Number(!dir)]},hsl(0,0%,50%),hsla(0,0%,50%,0))`,
|
|
45
|
+
`hsl(${zValue}, 100%, 50%)`
|
|
46
|
+
].join(",") }
|
|
47
|
+
};
|
|
90
48
|
};
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
}
|
|
101
|
-
};
|
|
102
|
-
return result;
|
|
49
|
+
const generateHSL_S = (orientation, dir, alphaValue) => {
|
|
50
|
+
return {
|
|
51
|
+
areaStyles: {},
|
|
52
|
+
areaGradientStyles: { background: [
|
|
53
|
+
`linear-gradient(to ${orientation[Number(!dir)]}, hsla(0,0%,0%,${alphaValue}) 0%, hsla(0,0%,0%,0) 50%, hsla(0,0%,100%,0) 50%, hsla(0,0%,100%,${alphaValue}) 100%)`,
|
|
54
|
+
`linear-gradient(to ${orientation[Number(dir)]},hsla(0,100%,50%,${alphaValue}),hsla(60,100%,50%,${alphaValue}),hsla(120,100%,50%,${alphaValue}),hsla(180,100%,50%,${alphaValue}),hsla(240,100%,50%,${alphaValue}),hsla(300,100%,50%,${alphaValue}),hsla(359,100%,50%,${alphaValue}))`,
|
|
55
|
+
"hsl(0, 0%, 50%)"
|
|
56
|
+
].join(",") }
|
|
57
|
+
};
|
|
103
58
|
};
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
`linear-gradient(to ${orientation[Number(!dir)]},hsl(0,0%,${zValue}%),hsla(0,0%,${zValue}%,0))`,
|
|
110
|
-
`linear-gradient(to ${orientation[Number(dir)]},hsl(0,100%,${zValue}%),hsl(60,100%,${zValue}%),hsl(120,100%,${zValue}%),hsl(180,100%,${zValue}%),hsl(240,100%,${zValue}%),hsl(300,100%,${zValue}%),hsl(360,100%,${zValue}%))`
|
|
111
|
-
].join(",")
|
|
112
|
-
}
|
|
113
|
-
};
|
|
114
|
-
return result;
|
|
59
|
+
const generateHSL_L = (orientation, dir, zValue) => {
|
|
60
|
+
return {
|
|
61
|
+
areaStyles: {},
|
|
62
|
+
areaGradientStyles: { backgroundImage: [`linear-gradient(to ${orientation[Number(!dir)]},hsl(0,0%,${zValue}%),hsla(0,0%,${zValue}%,0))`, `linear-gradient(to ${orientation[Number(dir)]},hsl(0,100%,${zValue}%),hsl(60,100%,${zValue}%),hsl(120,100%,${zValue}%),hsl(180,100%,${zValue}%),hsl(240,100%,${zValue}%),hsl(300,100%,${zValue}%),hsl(360,100%,${zValue}%))`].join(",") }
|
|
63
|
+
};
|
|
115
64
|
};
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
}
|
|
126
|
-
};
|
|
127
|
-
return result;
|
|
65
|
+
const generateHSB_H = (orientation, dir, zValue) => {
|
|
66
|
+
return {
|
|
67
|
+
areaStyles: {},
|
|
68
|
+
areaGradientStyles: { background: [
|
|
69
|
+
`linear-gradient(to ${orientation[Number(dir)]},hsl(0,0%,0%),hsla(0,0%,0%,0))`,
|
|
70
|
+
`linear-gradient(to ${orientation[Number(!dir)]},hsl(0,0%,100%),hsla(0,0%,100%,0))`,
|
|
71
|
+
`hsl(${zValue}, 100%, 50%)`
|
|
72
|
+
].join(",") }
|
|
73
|
+
};
|
|
128
74
|
};
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
}
|
|
139
|
-
};
|
|
140
|
-
return result;
|
|
75
|
+
const generateHSB_S = (orientation, dir, alphaValue) => {
|
|
76
|
+
return {
|
|
77
|
+
areaStyles: {},
|
|
78
|
+
areaGradientStyles: { background: [
|
|
79
|
+
`linear-gradient(to ${orientation[Number(!dir)]},hsla(0,0%,0%,${alphaValue}),hsla(0,0%,0%,0))`,
|
|
80
|
+
`linear-gradient(to ${orientation[Number(dir)]},hsla(0,100%,50%,${alphaValue}),hsla(60,100%,50%,${alphaValue}),hsla(120,100%,50%,${alphaValue}),hsla(180,100%,50%,${alphaValue}),hsla(240,100%,50%,${alphaValue}),hsla(300,100%,50%,${alphaValue}),hsla(359,100%,50%,${alphaValue}))`,
|
|
81
|
+
`linear-gradient(to ${orientation[Number(!dir)]},hsl(0,0%,0%),hsl(0,0%,100%))`
|
|
82
|
+
].join(",") }
|
|
83
|
+
};
|
|
141
84
|
};
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
}
|
|
152
|
-
};
|
|
153
|
-
return result;
|
|
85
|
+
const generateHSB_B = (orientation, dir, alphaValue) => {
|
|
86
|
+
return {
|
|
87
|
+
areaStyles: {},
|
|
88
|
+
areaGradientStyles: { background: [
|
|
89
|
+
`linear-gradient(to ${orientation[Number(!dir)]},hsla(0,0%,100%,${alphaValue}),hsla(0,0%,100%,0))`,
|
|
90
|
+
`linear-gradient(to ${orientation[Number(dir)]},hsla(0,100%,50%,${alphaValue}),hsla(60,100%,50%,${alphaValue}),hsla(120,100%,50%,${alphaValue}),hsla(180,100%,50%,${alphaValue}),hsla(240,100%,50%,${alphaValue}),hsla(300,100%,50%,${alphaValue}),hsla(359,100%,50%,${alphaValue}))`,
|
|
91
|
+
"#000"
|
|
92
|
+
].join(",") }
|
|
93
|
+
};
|
|
154
94
|
};
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
};
|
|
168
|
-
return result;
|
|
95
|
+
/** oklab: x = a, y = b, z = lightness (fixed L) */
|
|
96
|
+
const generateOKLAB_AB = (orientation, dir, L) => {
|
|
97
|
+
const l = L === 0 ? "none" : `${(L * 100).toFixed(2)}%`;
|
|
98
|
+
const maskImage = `linear-gradient(to ${orientation[Number(!dir)]}, black, transparent)`;
|
|
99
|
+
return {
|
|
100
|
+
areaStyles: { background: `linear-gradient(to ${orientation[Number(dir)]} in oklab, oklab(${l} -100% 100%), oklab(${l} 100% 100%))` },
|
|
101
|
+
areaGradientStyles: {
|
|
102
|
+
background: `linear-gradient(to ${orientation[Number(dir)]} in oklab, oklab(${l} -100% -100%), oklab(${l} 100% -100%))`,
|
|
103
|
+
maskImage,
|
|
104
|
+
WebkitMaskImage: maskImage
|
|
105
|
+
}
|
|
106
|
+
};
|
|
169
107
|
};
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
};
|
|
182
|
-
return result;
|
|
108
|
+
/** oklch: x = lightness, y = chroma, z = hue (fixed H) */
|
|
109
|
+
const generateOKLCH_LC = (orientation, dir, H) => {
|
|
110
|
+
const maskImage = `linear-gradient(to ${orientation[Number(dir)]}, transparent, black)`;
|
|
111
|
+
return {
|
|
112
|
+
areaStyles: { background: `linear-gradient(to ${orientation[Number(!dir)]} in oklch, oklch(0 0.001 ${H}), oklch(1 0.001 ${H}))` },
|
|
113
|
+
areaGradientStyles: {
|
|
114
|
+
background: `linear-gradient(to ${orientation[Number(!dir)]} in oklch, oklch(0 0.5 ${H}), oklch(1 0.5 ${H}))`,
|
|
115
|
+
maskImage,
|
|
116
|
+
WebkitMaskImage: maskImage
|
|
117
|
+
}
|
|
118
|
+
};
|
|
183
119
|
};
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
generateRGB_G,
|
|
196
|
-
generateRGB_R
|
|
197
|
-
});
|
|
120
|
+
exports.generateHSB_B = generateHSB_B;
|
|
121
|
+
exports.generateHSB_H = generateHSB_H;
|
|
122
|
+
exports.generateHSB_S = generateHSB_S;
|
|
123
|
+
exports.generateHSL_H = generateHSL_H;
|
|
124
|
+
exports.generateHSL_L = generateHSL_L;
|
|
125
|
+
exports.generateHSL_S = generateHSL_S;
|
|
126
|
+
exports.generateOKLAB_AB = generateOKLAB_AB;
|
|
127
|
+
exports.generateOKLCH_LC = generateOKLCH_LC;
|
|
128
|
+
exports.generateRGB_B = generateRGB_B;
|
|
129
|
+
exports.generateRGB_G = generateRGB_G;
|
|
130
|
+
exports.generateRGB_R = generateRGB_R;
|