@img/colour 1.0.0 → 1.1.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/color.cjs +11 -9
- package/index.d.ts +929 -0
- package/package.json +21 -8
package/color.cjs
CHANGED
|
@@ -24,7 +24,7 @@ __export(index_exports, {
|
|
|
24
24
|
module.exports = __toCommonJS(index_exports);
|
|
25
25
|
|
|
26
26
|
// node_modules/color-name/index.js
|
|
27
|
-
var
|
|
27
|
+
var colors = {
|
|
28
28
|
aliceblue: [240, 248, 255],
|
|
29
29
|
antiquewhite: [250, 235, 215],
|
|
30
30
|
aqua: [0, 255, 255],
|
|
@@ -174,6 +174,8 @@ var color_name_default = {
|
|
|
174
174
|
yellow: [255, 255, 0],
|
|
175
175
|
yellowgreen: [154, 205, 50]
|
|
176
176
|
};
|
|
177
|
+
for (const key in colors) Object.freeze(colors[key]);
|
|
178
|
+
var color_name_default = Object.freeze(colors);
|
|
177
179
|
|
|
178
180
|
// node_modules/color-string/index.js
|
|
179
181
|
var reverseNames = /* @__PURE__ */ Object.create(null);
|
|
@@ -218,8 +220,8 @@ cs.get.rgb = function(string) {
|
|
|
218
220
|
}
|
|
219
221
|
const abbr = /^#([a-f\d]{3,4})$/i;
|
|
220
222
|
const hex = /^#([a-f\d]{6})([a-f\d]{2})?$/i;
|
|
221
|
-
const rgba = /^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[\s,|/]\s*([+-]?
|
|
222
|
-
const per = /^rgba?\(\s*([+-]?[\d.]+)%\s*,?\s*([+-]?[\d.]+)%\s*,?\s*([+-]?[\d.]+)%\s*(?:[\s,|/]\s*([+-]?[\d.]+)(%?)\s*)?\)
|
|
223
|
+
const rgba = /^rgba?\(\s*([+-]?(?:\d*\.)?\d+(?:e\d+)?)(?=[\s,])\s*(?:,\s*)?([+-]?(?:\d*\.)?\d+(?:e\d+)?)(?=[\s,])\s*(?:,\s*)?([+-]?(?:\d*\.)?\d+(?:e\d+)?)\s*(?:[\s,|/]\s*([+-]?(?:\d*\.)?\d+(?:e\d+)?)(%?)\s*)?\)$/i;
|
|
224
|
+
const per = /^rgba?\(\s*([+-]?[\d.]+)%\s*,?\s*([+-]?[\d.]+)%\s*,?\s*([+-]?[\d.]+)%\s*(?:[\s,|/]\s*([+-]?[\d.]+)(%?)\s*)?\)$/i;
|
|
223
225
|
const keyword = /^(\w+)$/;
|
|
224
226
|
let rgb = [0, 0, 0, 1];
|
|
225
227
|
let match;
|
|
@@ -246,7 +248,7 @@ cs.get.rgb = function(string) {
|
|
|
246
248
|
}
|
|
247
249
|
} else if (match = string.match(rgba)) {
|
|
248
250
|
for (i = 0; i < 3; i++) {
|
|
249
|
-
rgb[i] = Number.
|
|
251
|
+
rgb[i] = Number.parseFloat(match[i + 1]);
|
|
250
252
|
}
|
|
251
253
|
if (match[4]) {
|
|
252
254
|
rgb[3] = match[5] ? Number.parseFloat(match[4]) * 0.01 : Number.parseFloat(match[4]);
|
|
@@ -258,14 +260,14 @@ cs.get.rgb = function(string) {
|
|
|
258
260
|
if (match[4]) {
|
|
259
261
|
rgb[3] = match[5] ? Number.parseFloat(match[4]) * 0.01 : Number.parseFloat(match[4]);
|
|
260
262
|
}
|
|
261
|
-
} else if (match = string.match(keyword)) {
|
|
263
|
+
} else if (match = string.toLowerCase().match(keyword)) {
|
|
262
264
|
if (match[1] === "transparent") {
|
|
263
265
|
return [0, 0, 0, 0];
|
|
264
266
|
}
|
|
265
267
|
if (!Object.hasOwn(color_name_default, match[1])) {
|
|
266
268
|
return null;
|
|
267
269
|
}
|
|
268
|
-
rgb = color_name_default[match[1]];
|
|
270
|
+
rgb = color_name_default[match[1]].slice();
|
|
269
271
|
rgb[3] = 1;
|
|
270
272
|
return rgb;
|
|
271
273
|
} else {
|
|
@@ -281,7 +283,7 @@ cs.get.hsl = function(string) {
|
|
|
281
283
|
if (!string) {
|
|
282
284
|
return null;
|
|
283
285
|
}
|
|
284
|
-
const hsl = /^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d.]+)%\s*,?\s*([+-]?[\d.]+)%\s*(?:[,|/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[
|
|
286
|
+
const hsl = /^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d.]+)%\s*,?\s*([+-]?[\d.]+)%\s*(?:[,|/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:e[+-]?\d+)?)\s*)?\)$/i;
|
|
285
287
|
const match = string.match(hsl);
|
|
286
288
|
if (match) {
|
|
287
289
|
const alpha = Number.parseFloat(match[4]);
|
|
@@ -297,7 +299,7 @@ cs.get.hwb = function(string) {
|
|
|
297
299
|
if (!string) {
|
|
298
300
|
return null;
|
|
299
301
|
}
|
|
300
|
-
const hwb = /^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*[\s,]\s*([+-]?[\d.]+)%\s*[\s,]\s*([+-]?[\d.]+)%\s*(?:[\s,]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[
|
|
302
|
+
const hwb = /^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*[\s,]\s*([+-]?[\d.]+)%\s*[\s,]\s*([+-]?[\d.]+)%\s*(?:[\s,]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:e[+-]?\d+)?)\s*)?\)$/i;
|
|
301
303
|
const match = string.match(hwb);
|
|
302
304
|
if (match) {
|
|
303
305
|
const alpha = Number.parseFloat(match[4]);
|
|
@@ -533,7 +535,7 @@ convert.rgb.keyword = function(rgb) {
|
|
|
533
535
|
return currentClosestKeyword;
|
|
534
536
|
};
|
|
535
537
|
convert.keyword.rgb = function(keyword) {
|
|
536
|
-
return color_name_default[keyword];
|
|
538
|
+
return [...color_name_default[keyword]];
|
|
537
539
|
};
|
|
538
540
|
convert.rgb.xyz = function(rgb) {
|
|
539
541
|
const r = srgbNonlinearTransformInv(rgb[0] / 255);
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,929 @@
|
|
|
1
|
+
// Generated by dts-bundle-generator v9.5.1
|
|
2
|
+
|
|
3
|
+
type Channels = number;
|
|
4
|
+
type RGB = [
|
|
5
|
+
r: number,
|
|
6
|
+
g: number,
|
|
7
|
+
b: number
|
|
8
|
+
];
|
|
9
|
+
type HSL = [
|
|
10
|
+
h: number,
|
|
11
|
+
s: number,
|
|
12
|
+
l: number
|
|
13
|
+
];
|
|
14
|
+
type HSV = [
|
|
15
|
+
h: number,
|
|
16
|
+
s: number,
|
|
17
|
+
v: number
|
|
18
|
+
];
|
|
19
|
+
type CMYK = [
|
|
20
|
+
c: number,
|
|
21
|
+
m: number,
|
|
22
|
+
y: number,
|
|
23
|
+
k: number
|
|
24
|
+
];
|
|
25
|
+
type LAB = [
|
|
26
|
+
l: number,
|
|
27
|
+
a: number,
|
|
28
|
+
b: number
|
|
29
|
+
];
|
|
30
|
+
type LCH = [
|
|
31
|
+
l: number,
|
|
32
|
+
c: number,
|
|
33
|
+
h: number
|
|
34
|
+
];
|
|
35
|
+
type HCG = [
|
|
36
|
+
h: number,
|
|
37
|
+
c: number,
|
|
38
|
+
g: number
|
|
39
|
+
];
|
|
40
|
+
type HWB = [
|
|
41
|
+
h: number,
|
|
42
|
+
w: number,
|
|
43
|
+
b: number
|
|
44
|
+
];
|
|
45
|
+
type XYZ = [
|
|
46
|
+
x: number,
|
|
47
|
+
y: number,
|
|
48
|
+
z: number
|
|
49
|
+
];
|
|
50
|
+
type Apple = [
|
|
51
|
+
r16: number,
|
|
52
|
+
g16: number,
|
|
53
|
+
b16: number
|
|
54
|
+
];
|
|
55
|
+
type Gray = [
|
|
56
|
+
gray: number
|
|
57
|
+
];
|
|
58
|
+
type ANSI16 = number;
|
|
59
|
+
type ANSI256 = number;
|
|
60
|
+
type Keyword = string;
|
|
61
|
+
type HEX = string;
|
|
62
|
+
declare namespace route {
|
|
63
|
+
type rgb = {
|
|
64
|
+
hsl(from: RGB): HSL;
|
|
65
|
+
hsl(...from: RGB): HSL;
|
|
66
|
+
hsl(from: RGB): HSL;
|
|
67
|
+
hsl(...from: RGB): HSL;
|
|
68
|
+
hsv(from: RGB): HSV;
|
|
69
|
+
hsv(...from: RGB): HSV;
|
|
70
|
+
hwb(from: RGB): HWB;
|
|
71
|
+
hwb(...from: RGB): HWB;
|
|
72
|
+
cmyk(from: RGB): CMYK;
|
|
73
|
+
cmyk(...from: RGB): CMYK;
|
|
74
|
+
xyz(from: RGB): XYZ;
|
|
75
|
+
xyz(...from: RGB): XYZ;
|
|
76
|
+
lab(from: RGB): LAB;
|
|
77
|
+
lab(...from: RGB): LAB;
|
|
78
|
+
lch(from: RGB): LCH;
|
|
79
|
+
lch(...from: RGB): LCH;
|
|
80
|
+
hex(from: RGB): HEX;
|
|
81
|
+
hex(...from: RGB): HEX;
|
|
82
|
+
keyword(from: RGB): Keyword;
|
|
83
|
+
keyword(...from: RGB): Keyword;
|
|
84
|
+
ansi16(from: RGB): ANSI16;
|
|
85
|
+
ansi16(...from: RGB): ANSI16;
|
|
86
|
+
ansi256(from: RGB): ANSI256;
|
|
87
|
+
ansi256(...from: RGB): ANSI256;
|
|
88
|
+
hcg(from: RGB): HCG;
|
|
89
|
+
hcg(...from: RGB): HCG;
|
|
90
|
+
apple(from: RGB): Apple;
|
|
91
|
+
apple(...from: RGB): Apple;
|
|
92
|
+
gray(from: RGB): Gray;
|
|
93
|
+
gray(...from: RGB): Gray;
|
|
94
|
+
};
|
|
95
|
+
type hsl = {
|
|
96
|
+
rgb(from: HSL): RGB;
|
|
97
|
+
rgb(...from: HSL): RGB;
|
|
98
|
+
hsv(from: HSL): HSV;
|
|
99
|
+
hsv(...from: HSL): HSV;
|
|
100
|
+
hwb(from: HSL): HWB;
|
|
101
|
+
hwb(...from: HSL): HWB;
|
|
102
|
+
cmyk(from: HSL): CMYK;
|
|
103
|
+
cmyk(...from: HSL): CMYK;
|
|
104
|
+
xyz(from: HSL): XYZ;
|
|
105
|
+
xyz(...from: HSL): XYZ;
|
|
106
|
+
lab(from: HSL): LAB;
|
|
107
|
+
lab(...from: HSL): LAB;
|
|
108
|
+
lch(from: HSL): LCH;
|
|
109
|
+
lch(...from: HSL): LCH;
|
|
110
|
+
hex(from: HSL): HEX;
|
|
111
|
+
hex(...from: HSL): HEX;
|
|
112
|
+
keyword(from: HSL): Keyword;
|
|
113
|
+
keyword(...from: HSL): Keyword;
|
|
114
|
+
ansi16(from: HSL): ANSI16;
|
|
115
|
+
ansi16(...from: HSL): ANSI16;
|
|
116
|
+
ansi256(from: HSL): ANSI256;
|
|
117
|
+
ansi256(...from: HSL): ANSI256;
|
|
118
|
+
hcg(from: HSL): HCG;
|
|
119
|
+
hcg(...from: HSL): HCG;
|
|
120
|
+
apple(from: HSL): Apple;
|
|
121
|
+
apple(...from: HSL): Apple;
|
|
122
|
+
gray(from: HSL): Gray;
|
|
123
|
+
gray(...from: HSL): Gray;
|
|
124
|
+
};
|
|
125
|
+
type hsv = {
|
|
126
|
+
rgb(from: HSV): RGB;
|
|
127
|
+
rgb(...from: HSV): RGB;
|
|
128
|
+
hsl(from: HSV): HSL;
|
|
129
|
+
hsl(...from: HSV): HSL;
|
|
130
|
+
hwb(from: HSV): HWB;
|
|
131
|
+
hwb(...from: HSV): HWB;
|
|
132
|
+
cmyk(from: HSV): CMYK;
|
|
133
|
+
cmyk(...from: HSV): CMYK;
|
|
134
|
+
xyz(from: HSV): XYZ;
|
|
135
|
+
xyz(...from: HSV): XYZ;
|
|
136
|
+
lab(from: HSV): LAB;
|
|
137
|
+
lab(...from: HSV): LAB;
|
|
138
|
+
lch(from: HSV): LCH;
|
|
139
|
+
lch(...from: HSV): LCH;
|
|
140
|
+
hex(from: HSV): HEX;
|
|
141
|
+
hex(...from: HSV): HEX;
|
|
142
|
+
keyword(from: HSV): Keyword;
|
|
143
|
+
keyword(...from: HSV): Keyword;
|
|
144
|
+
ansi16(from: HSV): ANSI16;
|
|
145
|
+
ansi16(...from: HSV): ANSI16;
|
|
146
|
+
ansi256(from: HSV): ANSI256;
|
|
147
|
+
ansi256(...from: HSV): ANSI256;
|
|
148
|
+
hcg(from: HSV): HCG;
|
|
149
|
+
hcg(...from: HSV): HCG;
|
|
150
|
+
apple(from: HSV): Apple;
|
|
151
|
+
apple(...from: HSV): Apple;
|
|
152
|
+
gray(from: HSV): Gray;
|
|
153
|
+
gray(...from: HSV): Gray;
|
|
154
|
+
};
|
|
155
|
+
type hwb = {
|
|
156
|
+
rgb(from: HWB): RGB;
|
|
157
|
+
rgb(...from: HWB): RGB;
|
|
158
|
+
hsl(from: HWB): HSL;
|
|
159
|
+
hsl(...from: HWB): HSL;
|
|
160
|
+
hsv(from: HWB): HSV;
|
|
161
|
+
hsv(...from: HWB): HSV;
|
|
162
|
+
cmyk(from: HWB): CMYK;
|
|
163
|
+
cmyk(...from: HWB): CMYK;
|
|
164
|
+
xyz(from: HWB): XYZ;
|
|
165
|
+
xyz(...from: HWB): XYZ;
|
|
166
|
+
lab(from: HWB): LAB;
|
|
167
|
+
lab(...from: HWB): LAB;
|
|
168
|
+
lch(from: HWB): LCH;
|
|
169
|
+
lch(...from: HWB): LCH;
|
|
170
|
+
hex(from: HWB): HEX;
|
|
171
|
+
hex(...from: HWB): HEX;
|
|
172
|
+
keyword(from: HWB): Keyword;
|
|
173
|
+
keyword(...from: HWB): Keyword;
|
|
174
|
+
ansi16(from: HWB): ANSI16;
|
|
175
|
+
ansi16(...from: HWB): ANSI16;
|
|
176
|
+
ansi256(from: HWB): ANSI256;
|
|
177
|
+
ansi256(...from: HWB): ANSI256;
|
|
178
|
+
hcg(from: HWB): HCG;
|
|
179
|
+
hcg(...from: HWB): HCG;
|
|
180
|
+
apple(from: HWB): Apple;
|
|
181
|
+
apple(...from: HWB): Apple;
|
|
182
|
+
gray(from: HWB): Gray;
|
|
183
|
+
gray(...from: HWB): Gray;
|
|
184
|
+
};
|
|
185
|
+
type cmyk = {
|
|
186
|
+
rgb(from: CMYK): RGB;
|
|
187
|
+
rgb(...from: CMYK): RGB;
|
|
188
|
+
hsl(from: CMYK): HSL;
|
|
189
|
+
hsl(...from: CMYK): HSL;
|
|
190
|
+
hsv(from: CMYK): HSV;
|
|
191
|
+
hsv(...from: CMYK): HSV;
|
|
192
|
+
hwb(from: CMYK): HWB;
|
|
193
|
+
hwb(...from: CMYK): HWB;
|
|
194
|
+
xyz(from: CMYK): XYZ;
|
|
195
|
+
xyz(...from: CMYK): XYZ;
|
|
196
|
+
lab(from: CMYK): LAB;
|
|
197
|
+
lab(...from: CMYK): LAB;
|
|
198
|
+
lch(from: CMYK): LCH;
|
|
199
|
+
lch(...from: CMYK): LCH;
|
|
200
|
+
hex(from: CMYK): HEX;
|
|
201
|
+
hex(...from: CMYK): HEX;
|
|
202
|
+
keyword(from: CMYK): Keyword;
|
|
203
|
+
keyword(...from: CMYK): Keyword;
|
|
204
|
+
ansi16(from: CMYK): ANSI16;
|
|
205
|
+
ansi16(...from: CMYK): ANSI16;
|
|
206
|
+
ansi256(from: CMYK): ANSI256;
|
|
207
|
+
ansi256(...from: CMYK): ANSI256;
|
|
208
|
+
hcg(from: CMYK): HCG;
|
|
209
|
+
hcg(...from: CMYK): HCG;
|
|
210
|
+
apple(from: CMYK): Apple;
|
|
211
|
+
apple(...from: CMYK): Apple;
|
|
212
|
+
gray(from: CMYK): Gray;
|
|
213
|
+
gray(...from: CMYK): Gray;
|
|
214
|
+
};
|
|
215
|
+
type xyz = {
|
|
216
|
+
rgb(from: XYZ): RGB;
|
|
217
|
+
rgb(...from: XYZ): RGB;
|
|
218
|
+
hsl(from: XYZ): HSL;
|
|
219
|
+
hsl(...from: XYZ): HSL;
|
|
220
|
+
hsv(from: XYZ): HSV;
|
|
221
|
+
hsv(...from: XYZ): HSV;
|
|
222
|
+
hwb(from: XYZ): HWB;
|
|
223
|
+
hwb(...from: XYZ): HWB;
|
|
224
|
+
cmyk(from: XYZ): CMYK;
|
|
225
|
+
cmyk(...from: XYZ): CMYK;
|
|
226
|
+
lab(from: XYZ): LAB;
|
|
227
|
+
lab(...from: XYZ): LAB;
|
|
228
|
+
lch(from: XYZ): LCH;
|
|
229
|
+
lch(...from: XYZ): LCH;
|
|
230
|
+
hex(from: XYZ): HEX;
|
|
231
|
+
hex(...from: XYZ): HEX;
|
|
232
|
+
keyword(from: XYZ): Keyword;
|
|
233
|
+
keyword(...from: XYZ): Keyword;
|
|
234
|
+
ansi16(from: XYZ): ANSI16;
|
|
235
|
+
ansi16(...from: XYZ): ANSI16;
|
|
236
|
+
ansi256(from: XYZ): ANSI256;
|
|
237
|
+
ansi256(...from: XYZ): ANSI256;
|
|
238
|
+
hcg(from: XYZ): HCG;
|
|
239
|
+
hcg(...from: XYZ): HCG;
|
|
240
|
+
apple(from: XYZ): Apple;
|
|
241
|
+
apple(...from: XYZ): Apple;
|
|
242
|
+
gray(from: XYZ): Gray;
|
|
243
|
+
gray(...from: XYZ): Gray;
|
|
244
|
+
};
|
|
245
|
+
type lab = {
|
|
246
|
+
rgb(from: LAB): RGB;
|
|
247
|
+
rgb(...from: LAB): RGB;
|
|
248
|
+
hsl(from: LAB): HSL;
|
|
249
|
+
hsl(...from: LAB): HSL;
|
|
250
|
+
hsv(from: LAB): HSV;
|
|
251
|
+
hsv(...from: LAB): HSV;
|
|
252
|
+
hwb(from: LAB): HWB;
|
|
253
|
+
hwb(...from: LAB): HWB;
|
|
254
|
+
cmyk(from: LAB): CMYK;
|
|
255
|
+
cmyk(...from: LAB): CMYK;
|
|
256
|
+
xyz(from: LAB): XYZ;
|
|
257
|
+
xyz(...from: LAB): XYZ;
|
|
258
|
+
lch(from: LAB): LCH;
|
|
259
|
+
lch(...from: LAB): LCH;
|
|
260
|
+
hex(from: LAB): HEX;
|
|
261
|
+
hex(...from: LAB): HEX;
|
|
262
|
+
keyword(from: LAB): Keyword;
|
|
263
|
+
keyword(...from: LAB): Keyword;
|
|
264
|
+
ansi16(from: LAB): ANSI16;
|
|
265
|
+
ansi16(...from: LAB): ANSI16;
|
|
266
|
+
ansi256(from: LAB): ANSI256;
|
|
267
|
+
ansi256(...from: LAB): ANSI256;
|
|
268
|
+
hcg(from: LAB): HCG;
|
|
269
|
+
hcg(...from: LAB): HCG;
|
|
270
|
+
apple(from: LAB): Apple;
|
|
271
|
+
apple(...from: LAB): Apple;
|
|
272
|
+
gray(from: LAB): Gray;
|
|
273
|
+
gray(...from: LAB): Gray;
|
|
274
|
+
};
|
|
275
|
+
type lch = {
|
|
276
|
+
rgb(from: LCH): RGB;
|
|
277
|
+
rgb(...from: LCH): RGB;
|
|
278
|
+
hsl(from: LCH): HSL;
|
|
279
|
+
hsl(...from: LCH): HSL;
|
|
280
|
+
hsv(from: LCH): HSV;
|
|
281
|
+
hsv(...from: LCH): HSV;
|
|
282
|
+
hwb(from: LCH): HWB;
|
|
283
|
+
hwb(...from: LCH): HWB;
|
|
284
|
+
cmyk(from: LCH): CMYK;
|
|
285
|
+
cmyk(...from: LCH): CMYK;
|
|
286
|
+
xyz(from: LCH): XYZ;
|
|
287
|
+
xyz(...from: LCH): XYZ;
|
|
288
|
+
lab(from: LCH): LAB;
|
|
289
|
+
lab(...from: LCH): LAB;
|
|
290
|
+
hex(from: LCH): HEX;
|
|
291
|
+
hex(...from: LCH): HEX;
|
|
292
|
+
keyword(from: LCH): Keyword;
|
|
293
|
+
keyword(...from: LCH): Keyword;
|
|
294
|
+
ansi16(from: LCH): ANSI16;
|
|
295
|
+
ansi16(...from: LCH): ANSI16;
|
|
296
|
+
ansi256(from: LCH): ANSI256;
|
|
297
|
+
ansi256(...from: LCH): ANSI256;
|
|
298
|
+
hcg(from: LCH): HCG;
|
|
299
|
+
hcg(...from: LCH): HCG;
|
|
300
|
+
apple(from: LCH): Apple;
|
|
301
|
+
apple(...from: LCH): Apple;
|
|
302
|
+
gray(from: LCH): Gray;
|
|
303
|
+
gray(...from: LCH): Gray;
|
|
304
|
+
};
|
|
305
|
+
type hex = {
|
|
306
|
+
rgb(from: HEX): RGB;
|
|
307
|
+
hsl(from: HEX): HSL;
|
|
308
|
+
hsv(from: HEX): HSV;
|
|
309
|
+
hwb(from: HEX): HWB;
|
|
310
|
+
cmyk(from: HEX): CMYK;
|
|
311
|
+
xyz(from: HEX): XYZ;
|
|
312
|
+
lab(from: HEX): LAB;
|
|
313
|
+
lch(from: HEX): LCH;
|
|
314
|
+
keyword(from: HEX): Keyword;
|
|
315
|
+
ansi16(from: HEX): ANSI16;
|
|
316
|
+
ansi256(from: HEX): ANSI256;
|
|
317
|
+
hcg(from: HEX): HCG;
|
|
318
|
+
apple(from: HEX): Apple;
|
|
319
|
+
gray(from: HEX): Gray;
|
|
320
|
+
};
|
|
321
|
+
type keyword = {
|
|
322
|
+
rgb(from: Keyword): RGB;
|
|
323
|
+
hsl(from: Keyword): HSL;
|
|
324
|
+
hsv(from: Keyword): HSV;
|
|
325
|
+
hwb(from: Keyword): HWB;
|
|
326
|
+
cmyk(from: Keyword): CMYK;
|
|
327
|
+
xyz(from: Keyword): XYZ;
|
|
328
|
+
lab(from: Keyword): LAB;
|
|
329
|
+
lch(from: Keyword): LCH;
|
|
330
|
+
hex(from: Keyword): HEX;
|
|
331
|
+
ansi16(from: Keyword): ANSI16;
|
|
332
|
+
ansi256(from: Keyword): ANSI256;
|
|
333
|
+
hcg(from: Keyword): HCG;
|
|
334
|
+
apple(from: Keyword): Apple;
|
|
335
|
+
gray(from: Keyword): Gray;
|
|
336
|
+
};
|
|
337
|
+
type ansi16 = {
|
|
338
|
+
rgb(from: ANSI16): RGB;
|
|
339
|
+
hsl(from: ANSI16): HSL;
|
|
340
|
+
hsv(from: ANSI16): HSV;
|
|
341
|
+
hwb(from: ANSI16): HWB;
|
|
342
|
+
cmyk(from: ANSI16): CMYK;
|
|
343
|
+
xyz(from: ANSI16): XYZ;
|
|
344
|
+
lab(from: ANSI16): LAB;
|
|
345
|
+
lch(from: ANSI16): LCH;
|
|
346
|
+
hex(from: ANSI16): HEX;
|
|
347
|
+
keyword(from: ANSI16): Keyword;
|
|
348
|
+
ansi256(from: ANSI16): ANSI256;
|
|
349
|
+
hcg(from: ANSI16): HCG;
|
|
350
|
+
apple(from: ANSI16): Apple;
|
|
351
|
+
gray(from: ANSI16): Gray;
|
|
352
|
+
};
|
|
353
|
+
type ansi256 = {
|
|
354
|
+
rgb(from: ANSI256): RGB;
|
|
355
|
+
hsl(from: ANSI256): HSL;
|
|
356
|
+
hsv(from: ANSI256): HSV;
|
|
357
|
+
hwb(from: ANSI256): HWB;
|
|
358
|
+
cmyk(from: ANSI256): CMYK;
|
|
359
|
+
xyz(from: ANSI256): XYZ;
|
|
360
|
+
lab(from: ANSI256): LAB;
|
|
361
|
+
lch(from: ANSI256): LCH;
|
|
362
|
+
hex(from: ANSI256): HEX;
|
|
363
|
+
keyword(from: ANSI256): Keyword;
|
|
364
|
+
ansi16(from: ANSI256): ANSI16;
|
|
365
|
+
hcg(from: ANSI256): HCG;
|
|
366
|
+
apple(from: ANSI256): Apple;
|
|
367
|
+
gray(from: ANSI256): Gray;
|
|
368
|
+
};
|
|
369
|
+
type hcg = {
|
|
370
|
+
rgb(from: HCG): RGB;
|
|
371
|
+
rgb(...from: HCG): RGB;
|
|
372
|
+
hsl(from: HCG): HSL;
|
|
373
|
+
hsl(...from: HCG): HSL;
|
|
374
|
+
hsv(from: HCG): HSV;
|
|
375
|
+
hsv(...from: HCG): HSV;
|
|
376
|
+
hwb(from: HCG): HWB;
|
|
377
|
+
hwb(...from: HCG): HWB;
|
|
378
|
+
cmyk(from: HCG): CMYK;
|
|
379
|
+
cmyk(...from: HCG): CMYK;
|
|
380
|
+
xyz(from: HCG): XYZ;
|
|
381
|
+
xyz(...from: HCG): XYZ;
|
|
382
|
+
lab(from: HCG): LAB;
|
|
383
|
+
lab(...from: HCG): LAB;
|
|
384
|
+
lch(from: HCG): LCH;
|
|
385
|
+
lch(...from: HCG): LCH;
|
|
386
|
+
hex(from: HCG): HEX;
|
|
387
|
+
hex(...from: HCG): HEX;
|
|
388
|
+
keyword(from: HCG): Keyword;
|
|
389
|
+
keyword(...from: HCG): Keyword;
|
|
390
|
+
ansi16(from: HCG): ANSI16;
|
|
391
|
+
ansi16(...from: HCG): ANSI16;
|
|
392
|
+
ansi256(from: HCG): ANSI256;
|
|
393
|
+
ansi256(...from: HCG): ANSI256;
|
|
394
|
+
apple(from: HCG): Apple;
|
|
395
|
+
apple(...from: HCG): Apple;
|
|
396
|
+
gray(from: HCG): Gray;
|
|
397
|
+
gray(...from: HCG): Gray;
|
|
398
|
+
};
|
|
399
|
+
type apple = {
|
|
400
|
+
rgb(from: Apple): RGB;
|
|
401
|
+
rgb(...from: Apple): RGB;
|
|
402
|
+
hsl(from: Apple): HSL;
|
|
403
|
+
hsl(...from: Apple): HSL;
|
|
404
|
+
hsv(from: Apple): HSV;
|
|
405
|
+
hsv(...from: Apple): HSV;
|
|
406
|
+
hwb(from: Apple): HWB;
|
|
407
|
+
hwb(...from: Apple): HWB;
|
|
408
|
+
cmyk(from: Apple): CMYK;
|
|
409
|
+
cmyk(...from: Apple): CMYK;
|
|
410
|
+
xyz(from: Apple): XYZ;
|
|
411
|
+
xyz(...from: Apple): XYZ;
|
|
412
|
+
lab(from: Apple): LAB;
|
|
413
|
+
lab(...from: Apple): LAB;
|
|
414
|
+
lch(from: Apple): LCH;
|
|
415
|
+
lch(...from: Apple): LCH;
|
|
416
|
+
hex(from: Apple): HEX;
|
|
417
|
+
hex(...from: Apple): HEX;
|
|
418
|
+
keyword(from: Apple): Keyword;
|
|
419
|
+
keyword(...from: Apple): Keyword;
|
|
420
|
+
ansi16(from: Apple): ANSI16;
|
|
421
|
+
ansi16(...from: Apple): ANSI16;
|
|
422
|
+
ansi256(from: Apple): ANSI256;
|
|
423
|
+
ansi256(...from: Apple): ANSI256;
|
|
424
|
+
hcg(from: Apple): HCG;
|
|
425
|
+
hcg(...from: Apple): HCG;
|
|
426
|
+
gray(from: Apple): Gray;
|
|
427
|
+
gray(...from: Apple): Gray;
|
|
428
|
+
};
|
|
429
|
+
type gray = {
|
|
430
|
+
rgb(from: Gray): RGB;
|
|
431
|
+
rgb(...from: Gray): RGB;
|
|
432
|
+
hsl(from: Gray): HSL;
|
|
433
|
+
hsl(...from: Gray): HSL;
|
|
434
|
+
hsv(from: Gray): HSV;
|
|
435
|
+
hsv(...from: Gray): HSV;
|
|
436
|
+
hwb(from: Gray): HWB;
|
|
437
|
+
hwb(...from: Gray): HWB;
|
|
438
|
+
cmyk(from: Gray): CMYK;
|
|
439
|
+
cmyk(...from: Gray): CMYK;
|
|
440
|
+
xyz(from: Gray): XYZ;
|
|
441
|
+
xyz(...from: Gray): XYZ;
|
|
442
|
+
lab(from: Gray): LAB;
|
|
443
|
+
lab(...from: Gray): LAB;
|
|
444
|
+
lch(from: Gray): LCH;
|
|
445
|
+
lch(...from: Gray): LCH;
|
|
446
|
+
hex(from: Gray): HEX;
|
|
447
|
+
hex(...from: Gray): HEX;
|
|
448
|
+
keyword(from: Gray): Keyword;
|
|
449
|
+
keyword(...from: Gray): Keyword;
|
|
450
|
+
ansi16(from: Gray): ANSI16;
|
|
451
|
+
ansi16(...from: Gray): ANSI16;
|
|
452
|
+
ansi256(from: Gray): ANSI256;
|
|
453
|
+
ansi256(...from: Gray): ANSI256;
|
|
454
|
+
hcg(from: Gray): HCG;
|
|
455
|
+
hcg(...from: Gray): HCG;
|
|
456
|
+
apple(from: Gray): Apple;
|
|
457
|
+
apple(...from: Gray): Apple;
|
|
458
|
+
};
|
|
459
|
+
}
|
|
460
|
+
declare function route(fromModel: "rgb"): route.rgb;
|
|
461
|
+
declare function route(fromModel: "hsl"): route.hsl;
|
|
462
|
+
declare function route(fromModel: "hsv"): route.hsv;
|
|
463
|
+
declare function route(fromModel: "hwb"): route.hwb;
|
|
464
|
+
declare function route(fromModel: "cmyk"): route.cmyk;
|
|
465
|
+
declare function route(fromModel: "xyz"): route.xyz;
|
|
466
|
+
declare function route(fromModel: "lab"): route.lab;
|
|
467
|
+
declare function route(fromModel: "lch"): route.lch;
|
|
468
|
+
declare function route(fromModel: "hex"): route.hex;
|
|
469
|
+
declare function route(fromModel: "keyword"): route.keyword;
|
|
470
|
+
declare function route(fromModel: "ansi16"): route.ansi16;
|
|
471
|
+
declare function route(fromModel: "ansi256"): route.ansi256;
|
|
472
|
+
declare function route(fromModel: "hcg"): route.hcg;
|
|
473
|
+
declare function route(fromModel: "apple"): route.apple;
|
|
474
|
+
declare function route(fromModel: "gray"): route.gray;
|
|
475
|
+
type Convert = {
|
|
476
|
+
rgb: {
|
|
477
|
+
channels: Channels;
|
|
478
|
+
labels: "rgb";
|
|
479
|
+
hsl: {
|
|
480
|
+
(...rgb: RGB): HSL;
|
|
481
|
+
raw: (...rgb: RGB) => HSL;
|
|
482
|
+
};
|
|
483
|
+
hsv: {
|
|
484
|
+
(...rgb: RGB): HSV;
|
|
485
|
+
raw: (...rgb: RGB) => HSV;
|
|
486
|
+
};
|
|
487
|
+
hwb: {
|
|
488
|
+
(...rgb: RGB): HWB;
|
|
489
|
+
raw: (...rgb: RGB) => HWB;
|
|
490
|
+
};
|
|
491
|
+
hcg: {
|
|
492
|
+
(...rgb: RGB): HCG;
|
|
493
|
+
raw: (...rgb: RGB) => HCG;
|
|
494
|
+
};
|
|
495
|
+
cmyk: {
|
|
496
|
+
(...rgb: RGB): CMYK;
|
|
497
|
+
raw: (...rgb: RGB) => CMYK;
|
|
498
|
+
};
|
|
499
|
+
keyword: {
|
|
500
|
+
(...rgb: RGB): Keyword;
|
|
501
|
+
raw: (...rgb: RGB) => Keyword;
|
|
502
|
+
};
|
|
503
|
+
ansi16: {
|
|
504
|
+
(...rgb: RGB): ANSI16;
|
|
505
|
+
raw: (...rgb: RGB) => ANSI16;
|
|
506
|
+
};
|
|
507
|
+
ansi256: {
|
|
508
|
+
(...rgb: RGB): ANSI256;
|
|
509
|
+
raw: (...rgb: RGB) => ANSI256;
|
|
510
|
+
};
|
|
511
|
+
apple: {
|
|
512
|
+
(...rgb: RGB): Apple;
|
|
513
|
+
raw: (...rgb: RGB) => Apple;
|
|
514
|
+
};
|
|
515
|
+
hex: {
|
|
516
|
+
(...rgb: RGB): HEX;
|
|
517
|
+
raw: (...rgb: RGB) => HEX;
|
|
518
|
+
};
|
|
519
|
+
gray: {
|
|
520
|
+
(...rgb: RGB): Gray;
|
|
521
|
+
raw: (...rgb: RGB) => Gray;
|
|
522
|
+
};
|
|
523
|
+
} & route.rgb & {
|
|
524
|
+
[F in keyof route.rgb]: {
|
|
525
|
+
raw: route.rgb[F];
|
|
526
|
+
};
|
|
527
|
+
};
|
|
528
|
+
keyword: {
|
|
529
|
+
channels: Channels;
|
|
530
|
+
rgb: {
|
|
531
|
+
(keyword: Keyword): RGB;
|
|
532
|
+
raw: (keyword: Keyword) => RGB;
|
|
533
|
+
};
|
|
534
|
+
} & route.keyword & {
|
|
535
|
+
[F in keyof route.keyword]: {
|
|
536
|
+
raw: route.keyword[F];
|
|
537
|
+
};
|
|
538
|
+
};
|
|
539
|
+
hsl: {
|
|
540
|
+
channels: Channels;
|
|
541
|
+
labels: "hsl";
|
|
542
|
+
rgb: {
|
|
543
|
+
(...hsl: HSL): RGB;
|
|
544
|
+
raw: (...hsl: HSL) => RGB;
|
|
545
|
+
};
|
|
546
|
+
hsv: {
|
|
547
|
+
(...hsl: HSL): HSV;
|
|
548
|
+
raw: (...hsl: HSL) => HSV;
|
|
549
|
+
};
|
|
550
|
+
hcg: {
|
|
551
|
+
(...hsl: HSL): HCG;
|
|
552
|
+
raw: (...hsl: HSL) => HCG;
|
|
553
|
+
};
|
|
554
|
+
} & route.hsl & {
|
|
555
|
+
[F in keyof route.hsl]: {
|
|
556
|
+
raw: route.hsl[F];
|
|
557
|
+
};
|
|
558
|
+
};
|
|
559
|
+
hsv: {
|
|
560
|
+
channels: Channels;
|
|
561
|
+
labels: "hsv";
|
|
562
|
+
hcg: {
|
|
563
|
+
(...hsv: HSV): HCG;
|
|
564
|
+
raw: (...hsv: HSV) => HCG;
|
|
565
|
+
};
|
|
566
|
+
rgb: {
|
|
567
|
+
(...hsv: HSV): RGB;
|
|
568
|
+
raw: (...hsv: HSV) => RGB;
|
|
569
|
+
};
|
|
570
|
+
hsv: {
|
|
571
|
+
(...hsv: HSV): HSV;
|
|
572
|
+
raw: (...hsv: HSV) => HSV;
|
|
573
|
+
};
|
|
574
|
+
hsl: {
|
|
575
|
+
(...hsv: HSV): HSL;
|
|
576
|
+
raw: (...hsv: HSV) => HSL;
|
|
577
|
+
};
|
|
578
|
+
hwb: {
|
|
579
|
+
(...hsv: HSV): HWB;
|
|
580
|
+
raw: (...hsv: HSV) => HWB;
|
|
581
|
+
};
|
|
582
|
+
ansi16: {
|
|
583
|
+
(...hsv: HSV): ANSI16;
|
|
584
|
+
raw: (...hsv: HSV) => ANSI16;
|
|
585
|
+
};
|
|
586
|
+
} & route.hsv & {
|
|
587
|
+
[F in keyof route.hsv]: {
|
|
588
|
+
raw: route.hsv[F];
|
|
589
|
+
};
|
|
590
|
+
};
|
|
591
|
+
hwb: {
|
|
592
|
+
channels: Channels;
|
|
593
|
+
labels: "hwb";
|
|
594
|
+
hcg: {
|
|
595
|
+
(...hwb: HWB): HCG;
|
|
596
|
+
raw: (...hwb: HWB) => HCG;
|
|
597
|
+
};
|
|
598
|
+
rgb: {
|
|
599
|
+
(...hwb: HWB): RGB;
|
|
600
|
+
raw: (...hwb: HWB) => RGB;
|
|
601
|
+
};
|
|
602
|
+
} & route.hwb & {
|
|
603
|
+
[F in keyof route.hwb]: {
|
|
604
|
+
raw: route.hwb[F];
|
|
605
|
+
};
|
|
606
|
+
};
|
|
607
|
+
cmyk: {
|
|
608
|
+
channels: Channels;
|
|
609
|
+
labels: "cmyk";
|
|
610
|
+
rgb: {
|
|
611
|
+
(...cmyk: CMYK): RGB;
|
|
612
|
+
raw: (...cmyk: CMYK) => RGB;
|
|
613
|
+
};
|
|
614
|
+
} & route.cmyk & {
|
|
615
|
+
[F in keyof route.cmyk]: {
|
|
616
|
+
raw: route.cmyk[F];
|
|
617
|
+
};
|
|
618
|
+
};
|
|
619
|
+
xyz: {
|
|
620
|
+
channels: Channels;
|
|
621
|
+
labels: "xyz";
|
|
622
|
+
rgb: {
|
|
623
|
+
(...xyz: XYZ): RGB;
|
|
624
|
+
raw: (...xyz: XYZ) => RGB;
|
|
625
|
+
};
|
|
626
|
+
lab: {
|
|
627
|
+
(...xyz: XYZ): LAB;
|
|
628
|
+
raw: (...xyz: XYZ) => LAB;
|
|
629
|
+
};
|
|
630
|
+
} & route.xyz & {
|
|
631
|
+
[F in keyof route.xyz]: {
|
|
632
|
+
raw: route.xyz[F];
|
|
633
|
+
};
|
|
634
|
+
};
|
|
635
|
+
lab: {
|
|
636
|
+
channels: Channels;
|
|
637
|
+
labels: "lab";
|
|
638
|
+
xyz: {
|
|
639
|
+
(...lab: LAB): XYZ;
|
|
640
|
+
raw: (...lab: LAB) => XYZ;
|
|
641
|
+
};
|
|
642
|
+
lch: {
|
|
643
|
+
(...lab: LAB): LCH;
|
|
644
|
+
raw: (...lab: LAB) => LCH;
|
|
645
|
+
};
|
|
646
|
+
} & route.lab & {
|
|
647
|
+
[F in keyof route.lab]: {
|
|
648
|
+
raw: route.lab[F];
|
|
649
|
+
};
|
|
650
|
+
};
|
|
651
|
+
lch: {
|
|
652
|
+
channels: Channels;
|
|
653
|
+
labels: "lch";
|
|
654
|
+
lab: {
|
|
655
|
+
(...lch: LCH): LAB;
|
|
656
|
+
raw: (...lch: LCH) => LAB;
|
|
657
|
+
};
|
|
658
|
+
} & route.lch & {
|
|
659
|
+
[F in keyof route.lch]: {
|
|
660
|
+
raw: route.lch[F];
|
|
661
|
+
};
|
|
662
|
+
};
|
|
663
|
+
hex: {
|
|
664
|
+
channels: Channels;
|
|
665
|
+
labels: [
|
|
666
|
+
"hex"
|
|
667
|
+
];
|
|
668
|
+
rgb: {
|
|
669
|
+
(hex: HEX): RGB;
|
|
670
|
+
raw: (hex: HEX) => RGB;
|
|
671
|
+
};
|
|
672
|
+
} & route.hex & {
|
|
673
|
+
[F in keyof route.hex]: {
|
|
674
|
+
raw: route.hex[F];
|
|
675
|
+
};
|
|
676
|
+
};
|
|
677
|
+
ansi16: {
|
|
678
|
+
channels: Channels;
|
|
679
|
+
labels: [
|
|
680
|
+
"ansi16"
|
|
681
|
+
];
|
|
682
|
+
rgb: {
|
|
683
|
+
(ansi16: ANSI16): RGB;
|
|
684
|
+
raw: (ansi16: ANSI16) => RGB;
|
|
685
|
+
};
|
|
686
|
+
} & route.ansi16 & {
|
|
687
|
+
[F in keyof route.ansi16]: {
|
|
688
|
+
raw: route.ansi16[F];
|
|
689
|
+
};
|
|
690
|
+
};
|
|
691
|
+
ansi256: {
|
|
692
|
+
channels: Channels;
|
|
693
|
+
labels: [
|
|
694
|
+
"ansi256"
|
|
695
|
+
];
|
|
696
|
+
rgb: {
|
|
697
|
+
(ansi256: ANSI256): RGB;
|
|
698
|
+
raw: (ansi256: ANSI256) => RGB;
|
|
699
|
+
};
|
|
700
|
+
} & route.ansi256 & {
|
|
701
|
+
[F in keyof route.ansi256]: {
|
|
702
|
+
raw: route.ansi256[F];
|
|
703
|
+
};
|
|
704
|
+
};
|
|
705
|
+
hcg: {
|
|
706
|
+
channels: Channels;
|
|
707
|
+
labels: [
|
|
708
|
+
"h",
|
|
709
|
+
"c",
|
|
710
|
+
"g"
|
|
711
|
+
];
|
|
712
|
+
rgb: {
|
|
713
|
+
(...hcg: HCG): RGB;
|
|
714
|
+
raw: (...hcg: HCG) => RGB;
|
|
715
|
+
};
|
|
716
|
+
hsv: {
|
|
717
|
+
(...hcg: HCG): HSV;
|
|
718
|
+
raw: (...hcg: HCG) => HSV;
|
|
719
|
+
};
|
|
720
|
+
hwb: {
|
|
721
|
+
(...hcg: HCG): HWB;
|
|
722
|
+
raw: (...hcg: HCG) => HWB;
|
|
723
|
+
};
|
|
724
|
+
} & route.hcg & {
|
|
725
|
+
[F in keyof route.hcg]: {
|
|
726
|
+
raw: route.hcg[F];
|
|
727
|
+
};
|
|
728
|
+
};
|
|
729
|
+
apple: {
|
|
730
|
+
channels: Channels;
|
|
731
|
+
labels: [
|
|
732
|
+
"r16",
|
|
733
|
+
"g16",
|
|
734
|
+
"b16"
|
|
735
|
+
];
|
|
736
|
+
rgb: {
|
|
737
|
+
(...apple: Apple): RGB;
|
|
738
|
+
raw: (...apple: Apple) => RGB;
|
|
739
|
+
};
|
|
740
|
+
} & route.apple & {
|
|
741
|
+
[F in keyof route.apple]: {
|
|
742
|
+
raw: route.apple[F];
|
|
743
|
+
};
|
|
744
|
+
};
|
|
745
|
+
gray: {
|
|
746
|
+
channels: Channels;
|
|
747
|
+
labels: [
|
|
748
|
+
"gray"
|
|
749
|
+
];
|
|
750
|
+
rgb: {
|
|
751
|
+
(...gray: Gray): RGB;
|
|
752
|
+
raw: (...gray: Gray) => RGB;
|
|
753
|
+
};
|
|
754
|
+
hsl: {
|
|
755
|
+
(...gray: Gray): HSL;
|
|
756
|
+
raw: (...gray: Gray) => HSL;
|
|
757
|
+
};
|
|
758
|
+
hsv: {
|
|
759
|
+
(...gray: Gray): HSV;
|
|
760
|
+
raw: (...gray: Gray) => HSV;
|
|
761
|
+
};
|
|
762
|
+
hwb: {
|
|
763
|
+
(...gray: Gray): HWB;
|
|
764
|
+
raw: (...gray: Gray) => HWB;
|
|
765
|
+
};
|
|
766
|
+
cmyk: {
|
|
767
|
+
(...gray: Gray): CMYK;
|
|
768
|
+
raw: (...gray: Gray) => CMYK;
|
|
769
|
+
};
|
|
770
|
+
lab: {
|
|
771
|
+
(...gray: Gray): LAB;
|
|
772
|
+
raw: (...gray: Gray) => LAB;
|
|
773
|
+
};
|
|
774
|
+
hex: {
|
|
775
|
+
(...gray: Gray): HEX;
|
|
776
|
+
raw: (...gray: Gray) => HEX;
|
|
777
|
+
};
|
|
778
|
+
} & route.gray & {
|
|
779
|
+
[F in keyof route.gray]: {
|
|
780
|
+
raw: route.gray[F];
|
|
781
|
+
};
|
|
782
|
+
};
|
|
783
|
+
};
|
|
784
|
+
declare const convert: Convert;
|
|
785
|
+
export type ColorLike = ColorInstance | string | ArrayLike<number> | number | Record<string, any>;
|
|
786
|
+
export type ColorJson = {
|
|
787
|
+
model: string;
|
|
788
|
+
color: number[];
|
|
789
|
+
valpha: number;
|
|
790
|
+
};
|
|
791
|
+
export type ColorObject = {
|
|
792
|
+
alpha?: number | undefined;
|
|
793
|
+
} & Record<string, number>;
|
|
794
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
|
|
795
|
+
export interface ColorInstance {
|
|
796
|
+
toString(): string;
|
|
797
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
798
|
+
toJSON(): ColorJson;
|
|
799
|
+
string(places?: number): string;
|
|
800
|
+
percentString(places?: number): string;
|
|
801
|
+
array(): number[];
|
|
802
|
+
object(): ColorObject;
|
|
803
|
+
unitArray(): number[];
|
|
804
|
+
unitObject(): {
|
|
805
|
+
r: number;
|
|
806
|
+
g: number;
|
|
807
|
+
b: number;
|
|
808
|
+
alpha?: number | undefined;
|
|
809
|
+
};
|
|
810
|
+
round(places?: number): ColorInstance;
|
|
811
|
+
alpha(): number;
|
|
812
|
+
alpha(value: number): ColorInstance;
|
|
813
|
+
red(): number;
|
|
814
|
+
red(value: number): ColorInstance;
|
|
815
|
+
green(): number;
|
|
816
|
+
green(value: number): ColorInstance;
|
|
817
|
+
blue(): number;
|
|
818
|
+
blue(value: number): ColorInstance;
|
|
819
|
+
hue(): number;
|
|
820
|
+
hue(value: number): ColorInstance;
|
|
821
|
+
saturationl(): number;
|
|
822
|
+
saturationl(value: number): ColorInstance;
|
|
823
|
+
lightness(): number;
|
|
824
|
+
lightness(value: number): ColorInstance;
|
|
825
|
+
saturationv(): number;
|
|
826
|
+
saturationv(value: number): ColorInstance;
|
|
827
|
+
value(): number;
|
|
828
|
+
value(value: number): ColorInstance;
|
|
829
|
+
chroma(): number;
|
|
830
|
+
chroma(value: number): ColorInstance;
|
|
831
|
+
gray(): number;
|
|
832
|
+
gray(value: number): ColorInstance;
|
|
833
|
+
white(): number;
|
|
834
|
+
white(value: number): ColorInstance;
|
|
835
|
+
wblack(): number;
|
|
836
|
+
wblack(value: number): ColorInstance;
|
|
837
|
+
cyan(): number;
|
|
838
|
+
cyan(value: number): ColorInstance;
|
|
839
|
+
magenta(): number;
|
|
840
|
+
magenta(value: number): ColorInstance;
|
|
841
|
+
yellow(): number;
|
|
842
|
+
yellow(value: number): ColorInstance;
|
|
843
|
+
black(): number;
|
|
844
|
+
black(value: number): ColorInstance;
|
|
845
|
+
x(): number;
|
|
846
|
+
x(value: number): ColorInstance;
|
|
847
|
+
y(): number;
|
|
848
|
+
y(value: number): ColorInstance;
|
|
849
|
+
z(): number;
|
|
850
|
+
z(value: number): ColorInstance;
|
|
851
|
+
l(): number;
|
|
852
|
+
l(value: number): ColorInstance;
|
|
853
|
+
a(): number;
|
|
854
|
+
a(value: number): ColorInstance;
|
|
855
|
+
b(): number;
|
|
856
|
+
b(value: number): ColorInstance;
|
|
857
|
+
keyword(): string;
|
|
858
|
+
keyword<V extends string>(value: V): ColorInstance;
|
|
859
|
+
hex(): string;
|
|
860
|
+
hex<V extends string>(value: V): ColorInstance;
|
|
861
|
+
hexa(): string;
|
|
862
|
+
hexa<V extends string>(value: V): ColorInstance;
|
|
863
|
+
rgbNumber(): number;
|
|
864
|
+
luminosity(): number;
|
|
865
|
+
contrast(color2: ColorInstance): number;
|
|
866
|
+
level(color2: ColorInstance): "AAA" | "AA" | "";
|
|
867
|
+
isDark(): boolean;
|
|
868
|
+
isLight(): boolean;
|
|
869
|
+
negate(): ColorInstance;
|
|
870
|
+
lighten(ratio: number): ColorInstance;
|
|
871
|
+
darken(ratio: number): ColorInstance;
|
|
872
|
+
saturate(ratio: number): ColorInstance;
|
|
873
|
+
desaturate(ratio: number): ColorInstance;
|
|
874
|
+
whiten(ratio: number): ColorInstance;
|
|
875
|
+
blacken(ratio: number): ColorInstance;
|
|
876
|
+
grayscale(): ColorInstance;
|
|
877
|
+
fade(ratio: number): ColorInstance;
|
|
878
|
+
opaquer(ratio: number): ColorInstance;
|
|
879
|
+
rotate(degrees: number): ColorInstance;
|
|
880
|
+
mix(mixinColor: ColorInstance, weight?: number): ColorInstance;
|
|
881
|
+
rgb(...arguments_: number[]): ColorInstance;
|
|
882
|
+
hsl(...arguments_: number[]): ColorInstance;
|
|
883
|
+
hsv(...arguments_: number[]): ColorInstance;
|
|
884
|
+
hwb(...arguments_: number[]): ColorInstance;
|
|
885
|
+
cmyk(...arguments_: number[]): ColorInstance;
|
|
886
|
+
xyz(...arguments_: number[]): ColorInstance;
|
|
887
|
+
lab(...arguments_: number[]): ColorInstance;
|
|
888
|
+
lch(...arguments_: number[]): ColorInstance;
|
|
889
|
+
ansi16(...arguments_: number[]): ColorInstance;
|
|
890
|
+
ansi256(...arguments_: number[]): ColorInstance;
|
|
891
|
+
hcg(...arguments_: number[]): ColorInstance;
|
|
892
|
+
apple(...arguments_: number[]): ColorInstance;
|
|
893
|
+
}
|
|
894
|
+
export type ColorConstructor = {
|
|
895
|
+
(object?: ColorLike, model?: keyof (typeof convert)): ColorInstance;
|
|
896
|
+
new (object?: ColorLike, model?: keyof (typeof convert)): ColorInstance;
|
|
897
|
+
rgb(...value: number[]): ColorInstance;
|
|
898
|
+
rgb(color: ColorLike): ColorInstance;
|
|
899
|
+
hsl(...value: number[]): ColorInstance;
|
|
900
|
+
hsl(color: ColorLike): ColorInstance;
|
|
901
|
+
hsv(...value: number[]): ColorInstance;
|
|
902
|
+
hsv(color: ColorLike): ColorInstance;
|
|
903
|
+
hwb(...value: number[]): ColorInstance;
|
|
904
|
+
hwb(color: ColorLike): ColorInstance;
|
|
905
|
+
cmyk(...value: number[]): ColorInstance;
|
|
906
|
+
cmyk(color: ColorLike): ColorInstance;
|
|
907
|
+
xyz(...value: number[]): ColorInstance;
|
|
908
|
+
xyz(color: ColorLike): ColorInstance;
|
|
909
|
+
lab(...value: number[]): ColorInstance;
|
|
910
|
+
lab(color: ColorLike): ColorInstance;
|
|
911
|
+
lch(...value: number[]): ColorInstance;
|
|
912
|
+
lch(color: ColorLike): ColorInstance;
|
|
913
|
+
ansi16(...value: number[]): ColorInstance;
|
|
914
|
+
ansi16(color: ColorLike): ColorInstance;
|
|
915
|
+
ansi256(...value: number[]): ColorInstance;
|
|
916
|
+
ansi256(color: ColorLike): ColorInstance;
|
|
917
|
+
hcg(...value: number[]): ColorInstance;
|
|
918
|
+
hcg(color: ColorLike): ColorInstance;
|
|
919
|
+
apple(...value: number[]): ColorInstance;
|
|
920
|
+
apple(color: ColorLike): ColorInstance;
|
|
921
|
+
};
|
|
922
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
923
|
+
declare const Color: ColorConstructor;
|
|
924
|
+
|
|
925
|
+
export {
|
|
926
|
+
Color as default,
|
|
927
|
+
};
|
|
928
|
+
|
|
929
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,9 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@img/colour",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "The ESM-only 'color' package made compatible for use with CommonJS runtimes",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "index.cjs",
|
|
7
|
+
"types": "index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./index.d.ts",
|
|
11
|
+
"require": "./index.cjs",
|
|
12
|
+
"default": "./index.cjs"
|
|
13
|
+
},
|
|
14
|
+
"./package.json": "./package.json"
|
|
15
|
+
},
|
|
7
16
|
"authors": [
|
|
8
17
|
"Heather Arthur <fayearthur@gmail.com>",
|
|
9
18
|
"Josh Junon <josh@junon.me>",
|
|
@@ -15,7 +24,8 @@
|
|
|
15
24
|
"node": ">=18"
|
|
16
25
|
},
|
|
17
26
|
"files": [
|
|
18
|
-
"color.cjs"
|
|
27
|
+
"color.cjs",
|
|
28
|
+
"index.d.ts"
|
|
19
29
|
],
|
|
20
30
|
"publishConfig": {
|
|
21
31
|
"access": "public"
|
|
@@ -32,14 +42,17 @@
|
|
|
32
42
|
"commonjs"
|
|
33
43
|
],
|
|
34
44
|
"scripts": {
|
|
35
|
-
"build": "esbuild node_modules/color/index.js --bundle --platform=node --outfile=color.cjs",
|
|
45
|
+
"build:cjs": "esbuild node_modules/color/index.js --bundle --platform=node --outfile=color.cjs",
|
|
46
|
+
"build:dts": "dts-bundle-generator ./dts-src.ts -o index.d.ts --project tsconfig.build.json --external-inlines color --external-inlines color-convert --export-referenced-types=false",
|
|
47
|
+
"build": "npm run build:cjs && npm run build:dts",
|
|
36
48
|
"test": "node --test"
|
|
37
49
|
},
|
|
38
50
|
"devDependencies": {
|
|
39
|
-
"color": "5.0.
|
|
40
|
-
"color-convert": "3.1.
|
|
41
|
-
"color-name": "2.
|
|
42
|
-
"color-string": "2.1.
|
|
43
|
-
"
|
|
51
|
+
"color": "5.0.3",
|
|
52
|
+
"color-convert": "3.1.3",
|
|
53
|
+
"color-name": "2.1.0",
|
|
54
|
+
"color-string": "2.1.4",
|
|
55
|
+
"dts-bundle-generator": "^9.5.1",
|
|
56
|
+
"esbuild": "^0.27.3"
|
|
44
57
|
}
|
|
45
58
|
}
|