@kurkle/color 0.1.5 → 0.1.9
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/README.md +2 -1
- package/dist/color.d.ts +21 -15
- package/dist/color.esm.js +199 -191
- package/dist/color.js +193 -189
- package/dist/color.min.js +2 -2
- package/package.json +15 -19
- package/dist/color.esm.min.js +0 -14
package/README.md
CHANGED
|
@@ -64,6 +64,8 @@ hsv(244, 100%, 100%, 0.6)
|
|
|
64
64
|
|
|
65
65
|
[typedocs](https://kurkle.github.io/color/)
|
|
66
66
|
|
|
67
|
+
**note** The docs are for the ESM module. UMD module only exports the [default export](https://kurkle.github.io/color/globals.html#_default)
|
|
68
|
+
|
|
67
69
|
## Benchmarks
|
|
68
70
|
|
|
69
71
|
[benchmarks](https://kurkle.github.io/color/dev/bench/)
|
|
@@ -71,7 +73,6 @@ hsv(244, 100%, 100%, 0.6)
|
|
|
71
73
|
## Size visualization
|
|
72
74
|
|
|
73
75
|
[color.min.js](https://kurkle.github.io/color/stats.html)
|
|
74
|
-
[color.esm.min.js](https://kurkle.github.io/color/stats.esm.html)
|
|
75
76
|
|
|
76
77
|
## License
|
|
77
78
|
|
package/dist/color.d.ts
CHANGED
|
@@ -34,9 +34,9 @@ export function hexParse(str: string): {
|
|
|
34
34
|
* Return HEX string from color
|
|
35
35
|
* @param {RGBA} v - the color
|
|
36
36
|
*/
|
|
37
|
-
export function hexString(v:
|
|
37
|
+
export function hexString(v: RGBA): string | RGBA;
|
|
38
38
|
/**
|
|
39
|
-
* Rounds
|
|
39
|
+
* Rounds decimal to nearest integer
|
|
40
40
|
* @param {number} v - the number to round
|
|
41
41
|
*/
|
|
42
42
|
export function round(v: number): number;
|
|
@@ -70,7 +70,7 @@ export function n2p(v: number): number;
|
|
|
70
70
|
* @param {RGBA} v - the color
|
|
71
71
|
* @returns {number[]} - [h, s, l]
|
|
72
72
|
*/
|
|
73
|
-
export function rgb2hsl(v:
|
|
73
|
+
export function rgb2hsl(v: RGBA): number[];
|
|
74
74
|
/**
|
|
75
75
|
* Convert hsl to rgb
|
|
76
76
|
* @param {number|number[]} h - hue | [h, s, l]
|
|
@@ -100,46 +100,52 @@ export function hsv2rgb(h: number | number[], s?: number, v?: number): number[];
|
|
|
100
100
|
* @param {string} str - hsl/hsv/hwb color string
|
|
101
101
|
* @returns {RGBA} - the parsed color components
|
|
102
102
|
*/
|
|
103
|
-
export function hueParse(str: string):
|
|
103
|
+
export function hueParse(str: string): RGBA;
|
|
104
104
|
/**
|
|
105
105
|
* Rotate the `v` color by `deg` degrees
|
|
106
106
|
* @param {RGBA} v - the color
|
|
107
107
|
* @param {number} deg - degrees to rotate
|
|
108
108
|
*/
|
|
109
|
-
export function rotate(v:
|
|
109
|
+
export function rotate(v: RGBA, deg: number): void;
|
|
110
110
|
/**
|
|
111
111
|
* Return hsl(a) string from color components
|
|
112
112
|
* @param {RGBA} v - the color
|
|
113
113
|
* @return {string|undefined}
|
|
114
114
|
*/
|
|
115
|
-
export function hslString(v:
|
|
115
|
+
export function hslString(v: RGBA): string;
|
|
116
116
|
/**
|
|
117
117
|
* Parse color name
|
|
118
118
|
* @param {string} str - the color name
|
|
119
119
|
* @return {RGBA} - the color
|
|
120
120
|
*/
|
|
121
|
-
export function nameParse(str: string):
|
|
121
|
+
export function nameParse(str: string): RGBA;
|
|
122
122
|
/**
|
|
123
123
|
* Parse rgb(a) string to RGBA
|
|
124
124
|
* @param {string} str - the rgb string
|
|
125
125
|
* @returns {RGBA} - the parsed color
|
|
126
126
|
*/
|
|
127
|
-
export function rgbParse(str: string):
|
|
127
|
+
export function rgbParse(str: string): RGBA;
|
|
128
128
|
/**
|
|
129
129
|
* Return rgb(a) string from color
|
|
130
130
|
* @param {RGBA} v - the color
|
|
131
131
|
*/
|
|
132
|
-
export function rgbString(v:
|
|
132
|
+
export function rgbString(v: RGBA): string;
|
|
133
133
|
|
|
134
134
|
export class Color {
|
|
135
135
|
/**
|
|
136
136
|
* constructor
|
|
137
137
|
* @param {Color|RGBA|string|number[]} input
|
|
138
138
|
*/
|
|
139
|
-
constructor(input: string | number[] | Color |
|
|
140
|
-
/**
|
|
139
|
+
constructor(input: string | number[] | Color | RGBA);
|
|
140
|
+
/**
|
|
141
|
+
* @type {RGBA}
|
|
142
|
+
* @hidden
|
|
143
|
+
**/
|
|
141
144
|
_rgb: RGBA;
|
|
142
|
-
/**
|
|
145
|
+
/**
|
|
146
|
+
* @type {boolean}
|
|
147
|
+
* @hidden
|
|
148
|
+
**/
|
|
143
149
|
_valid: boolean;
|
|
144
150
|
/**
|
|
145
151
|
* `true` if this is a valid color
|
|
@@ -149,11 +155,11 @@ export class Color {
|
|
|
149
155
|
/**
|
|
150
156
|
* @param {RGBA} obj - the color
|
|
151
157
|
*/
|
|
152
|
-
set rgb(arg:
|
|
158
|
+
set rgb(arg: RGBA);
|
|
153
159
|
/**
|
|
154
160
|
* @returns {RGBA} - the color
|
|
155
161
|
*/
|
|
156
|
-
get rgb():
|
|
162
|
+
get rgb(): RGBA;
|
|
157
163
|
/**
|
|
158
164
|
* rgb(a) string
|
|
159
165
|
*/
|
|
@@ -161,7 +167,7 @@ export class Color {
|
|
|
161
167
|
/**
|
|
162
168
|
* hex string
|
|
163
169
|
*/
|
|
164
|
-
hexString(): string |
|
|
170
|
+
hexString(): string | RGBA;
|
|
165
171
|
/**
|
|
166
172
|
* hsl(a) string
|
|
167
173
|
*/
|
package/dist/color.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @kurkle/color v0.1.
|
|
2
|
+
* @kurkle/color v0.1.9
|
|
3
3
|
* https://github.com/kurkle/color#readme
|
|
4
4
|
* (c) 2020 Jukka Kurkela
|
|
5
5
|
* Released under the MIT License
|
|
@@ -48,6 +48,9 @@ const lim = (v, l, h) => Math.max(Math.min(v, h), l);
|
|
|
48
48
|
function p2b(v) {
|
|
49
49
|
return lim(round(v * 2.55), 0, 255);
|
|
50
50
|
}
|
|
51
|
+
function b2p(v) {
|
|
52
|
+
return lim(round(v / 2.55), 0, 100);
|
|
53
|
+
}
|
|
51
54
|
function n2b(v) {
|
|
52
55
|
return lim(round(v * 255), 0, 255);
|
|
53
56
|
}
|
|
@@ -203,205 +206,209 @@ function hslString(v) {
|
|
|
203
206
|
: `hsl(${h}, ${s}%, ${l}%)`;
|
|
204
207
|
}
|
|
205
208
|
|
|
206
|
-
|
|
209
|
+
const map$1 = {
|
|
207
210
|
x: 'dark',
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
211
|
+
Z: 'light',
|
|
212
|
+
Y: 're',
|
|
213
|
+
X: 'blu',
|
|
214
|
+
W: 'gr',
|
|
215
|
+
V: 'medium',
|
|
216
|
+
U: 'slate',
|
|
217
|
+
A: 'ee',
|
|
218
|
+
T: 'ol',
|
|
219
|
+
S: 'or',
|
|
220
|
+
B: 'ra',
|
|
221
|
+
C: 'lateg',
|
|
222
|
+
D: 'ights',
|
|
223
|
+
R: 'in',
|
|
224
|
+
Q: 'turquois',
|
|
225
|
+
E: 'hi',
|
|
226
|
+
P: 'ro',
|
|
227
|
+
O: 'al',
|
|
228
|
+
N: 'le',
|
|
229
|
+
M: 'de',
|
|
230
|
+
L: 'yello',
|
|
231
|
+
F: 'en',
|
|
232
|
+
K: 'ch',
|
|
233
|
+
G: 'arks',
|
|
234
|
+
H: 'ea',
|
|
235
|
+
I: 'ightg',
|
|
236
|
+
J: 'wh'
|
|
237
|
+
};
|
|
238
|
+
const names = {
|
|
239
|
+
OiceXe: 'f0f8ff',
|
|
240
|
+
antiquewEte: 'faebd7',
|
|
241
|
+
aqua: 'ffff',
|
|
242
|
+
aquamarRe: '7fffd4',
|
|
243
|
+
azuY: 'f0ffff',
|
|
244
|
+
beige: 'f5f5dc',
|
|
245
|
+
bisque: 'ffe4c4',
|
|
246
|
+
black: '0',
|
|
247
|
+
blanKedOmond: 'ffebcd',
|
|
248
|
+
Xe: 'ff',
|
|
249
|
+
XeviTet: '8a2be2',
|
|
250
|
+
bPwn: 'a52a2a',
|
|
251
|
+
burlywood: 'deb887',
|
|
252
|
+
caMtXe: '5f9ea0',
|
|
253
|
+
KartYuse: '7fff00',
|
|
254
|
+
KocTate: 'd2691e',
|
|
255
|
+
cSO: 'ff7f50',
|
|
256
|
+
cSnflowerXe: '6495ed',
|
|
257
|
+
cSnsilk: 'fff8dc',
|
|
258
|
+
crimson: 'dc143c',
|
|
259
|
+
cyan: 'ffff',
|
|
260
|
+
xXe: '8b',
|
|
261
|
+
xcyan: '8b8b',
|
|
262
|
+
xgTMnPd: 'b8860b',
|
|
263
|
+
xWay: 'a9a9a9',
|
|
264
|
+
xgYF: '6400',
|
|
265
|
+
xgYy: 'a9a9a9',
|
|
266
|
+
xkhaki: 'bdb76b',
|
|
267
|
+
xmagFta: '8b008b',
|
|
268
|
+
xTivegYF: '556b2f',
|
|
269
|
+
xSange: 'ff8c00',
|
|
270
|
+
xScEd: '9932cc',
|
|
271
|
+
xYd: '8b0000',
|
|
272
|
+
xsOmon: 'e9967a',
|
|
273
|
+
xsHgYF: '8fbc8f',
|
|
274
|
+
xUXe: '483d8b',
|
|
275
|
+
xUWay: '2f4f4f',
|
|
276
|
+
xUgYy: '2f4f4f',
|
|
277
|
+
xQe: 'ced1',
|
|
278
|
+
xviTet: '9400d3',
|
|
279
|
+
dAppRk: 'ff1493',
|
|
280
|
+
dApskyXe: 'bfff',
|
|
281
|
+
dimWay: '696969',
|
|
282
|
+
dimgYy: '696969',
|
|
283
|
+
dodgerXe: '1e90ff',
|
|
284
|
+
fiYbrick: 'b22222',
|
|
285
|
+
flSOwEte: 'fffaf0',
|
|
286
|
+
foYstWAn: '228b22',
|
|
287
|
+
fuKsia: 'ff00ff',
|
|
288
|
+
gaRsbSo: 'dcdcdc',
|
|
289
|
+
ghostwEte: 'f8f8ff',
|
|
290
|
+
gTd: 'ffd700',
|
|
291
|
+
gTMnPd: 'daa520',
|
|
292
|
+
Way: '808080',
|
|
293
|
+
gYF: '8000',
|
|
294
|
+
gYFLw: 'adff2f',
|
|
295
|
+
gYy: '808080',
|
|
296
|
+
honeyMw: 'f0fff0',
|
|
297
|
+
hotpRk: 'ff69b4',
|
|
298
|
+
RdianYd: 'cd5c5c',
|
|
299
|
+
Rdigo: '4b0082',
|
|
300
|
+
ivSy: 'fffff0',
|
|
301
|
+
khaki: 'f0e68c',
|
|
302
|
+
lavFMr: 'e6e6fa',
|
|
303
|
+
lavFMrXsh: 'fff0f5',
|
|
304
|
+
lawngYF: '7cfc00',
|
|
305
|
+
NmoncEffon: 'fffacd',
|
|
306
|
+
ZXe: 'add8e6',
|
|
307
|
+
ZcSO: 'f08080',
|
|
308
|
+
Zcyan: 'e0ffff',
|
|
309
|
+
ZgTMnPdLw: 'fafad2',
|
|
310
|
+
ZWay: 'd3d3d3',
|
|
311
|
+
ZgYF: '90ee90',
|
|
312
|
+
ZgYy: 'd3d3d3',
|
|
313
|
+
ZpRk: 'ffb6c1',
|
|
314
|
+
ZsOmon: 'ffa07a',
|
|
315
|
+
ZsHgYF: '20b2aa',
|
|
316
|
+
ZskyXe: '87cefa',
|
|
317
|
+
ZUWay: '778899',
|
|
318
|
+
ZUgYy: '778899',
|
|
319
|
+
ZstAlXe: 'b0c4de',
|
|
320
|
+
ZLw: 'ffffe0',
|
|
321
|
+
lime: 'ff00',
|
|
322
|
+
limegYF: '32cd32',
|
|
323
|
+
lRF: 'faf0e6',
|
|
324
|
+
magFta: 'ff00ff',
|
|
325
|
+
maPon: '800000',
|
|
326
|
+
VaquamarRe: '66cdaa',
|
|
327
|
+
VXe: 'cd',
|
|
328
|
+
VScEd: 'ba55d3',
|
|
329
|
+
VpurpN: '9370db',
|
|
330
|
+
VsHgYF: '3cb371',
|
|
331
|
+
VUXe: '7b68ee',
|
|
332
|
+
VsprRggYF: 'fa9a',
|
|
333
|
+
VQe: '48d1cc',
|
|
334
|
+
VviTetYd: 'c71585',
|
|
335
|
+
midnightXe: '191970',
|
|
336
|
+
mRtcYam: 'f5fffa',
|
|
337
|
+
mistyPse: 'ffe4e1',
|
|
338
|
+
moccasR: 'ffe4b5',
|
|
339
|
+
navajowEte: 'ffdead',
|
|
340
|
+
navy: '80',
|
|
341
|
+
Tdlace: 'fdf5e6',
|
|
342
|
+
Tive: '808000',
|
|
343
|
+
TivedBb: '6b8e23',
|
|
344
|
+
Sange: 'ffa500',
|
|
345
|
+
SangeYd: 'ff4500',
|
|
346
|
+
ScEd: 'da70d6',
|
|
347
|
+
pOegTMnPd: 'eee8aa',
|
|
348
|
+
pOegYF: '98fb98',
|
|
349
|
+
pOeQe: 'afeeee',
|
|
350
|
+
pOeviTetYd: 'db7093',
|
|
351
|
+
papayawEp: 'ffefd5',
|
|
352
|
+
pHKpuff: 'ffdab9',
|
|
353
|
+
peru: 'cd853f',
|
|
354
|
+
pRk: 'ffc0cb',
|
|
355
|
+
plum: 'dda0dd',
|
|
356
|
+
powMrXe: 'b0e0e6',
|
|
357
|
+
purpN: '800080',
|
|
358
|
+
YbeccapurpN: '663399',
|
|
359
|
+
Yd: 'ff0000',
|
|
360
|
+
Psybrown: 'bc8f8f',
|
|
361
|
+
PyOXe: '4169e1',
|
|
362
|
+
saddNbPwn: '8b4513',
|
|
363
|
+
sOmon: 'fa8072',
|
|
364
|
+
sandybPwn: 'f4a460',
|
|
365
|
+
sHgYF: '2e8b57',
|
|
366
|
+
sHshell: 'fff5ee',
|
|
367
|
+
siFna: 'a0522d',
|
|
368
|
+
silver: 'c0c0c0',
|
|
369
|
+
skyXe: '87ceeb',
|
|
370
|
+
UXe: '6a5acd',
|
|
371
|
+
UWay: '708090',
|
|
372
|
+
UgYy: '708090',
|
|
373
|
+
snow: 'fffafa',
|
|
374
|
+
sprRggYF: 'ff7f',
|
|
375
|
+
stAlXe: '4682b4',
|
|
376
|
+
tan: 'd2b48c',
|
|
377
|
+
teO: '8080',
|
|
378
|
+
tEstN: 'd8bfd8',
|
|
379
|
+
tomato: 'ff6347',
|
|
380
|
+
Qe: '40e0d0',
|
|
381
|
+
viTet: 'ee82ee',
|
|
382
|
+
JHt: 'f5deb3',
|
|
383
|
+
wEte: 'ffffff',
|
|
384
|
+
wEtesmoke: 'f5f5f5',
|
|
385
|
+
Lw: 'ffff00',
|
|
386
|
+
LwgYF: '9acd32'
|
|
234
387
|
};
|
|
235
|
-
function unpack(
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
388
|
+
function unpack() {
|
|
389
|
+
const unpacked = {};
|
|
390
|
+
const keys = Object.keys(names);
|
|
391
|
+
const tkeys = Object.keys(map$1);
|
|
392
|
+
let i, j, k, ok, nk;
|
|
240
393
|
for (i = 0; i < keys.length; i++) {
|
|
241
394
|
ok = nk = keys[i];
|
|
242
395
|
for (j = 0; j < tkeys.length; j++) {
|
|
243
396
|
k = tkeys[j];
|
|
244
397
|
nk = nk.replace(k, map$1[k]);
|
|
245
398
|
}
|
|
246
|
-
k = parseInt(
|
|
399
|
+
k = parseInt(names[ok], 16);
|
|
247
400
|
unpacked[nk] = [k >> 16 & 0xFF, k >> 8 & 0xFF, k & 0xFF];
|
|
248
401
|
}
|
|
249
402
|
return unpacked;
|
|
250
403
|
}
|
|
251
|
-
const names = unpack({
|
|
252
|
-
OiceXe: 'f0f8ff',
|
|
253
|
-
antiquewEte: 'faebd7',
|
|
254
|
-
aqua: 'ffff',
|
|
255
|
-
aquamarRe: '7fffd4',
|
|
256
|
-
azuY: 'f0ffff',
|
|
257
|
-
beige: 'f5f5dc',
|
|
258
|
-
bisque: 'ffe4c4',
|
|
259
|
-
black: '0',
|
|
260
|
-
blanKedOmond: 'ffebcd',
|
|
261
|
-
Xe: 'ff',
|
|
262
|
-
XeviTet: '8a2be2',
|
|
263
|
-
bPwn: 'a52a2a',
|
|
264
|
-
burlywood: 'deb887',
|
|
265
|
-
caMtXe: '5f9ea0',
|
|
266
|
-
KartYuse: '7fff00',
|
|
267
|
-
KocTate: 'd2691e',
|
|
268
|
-
cSO: 'ff7f50',
|
|
269
|
-
cSnflowerXe: '6495ed',
|
|
270
|
-
cSnsilk: 'fff8dc',
|
|
271
|
-
crimson: 'dc143c',
|
|
272
|
-
cyan: 'ffff',
|
|
273
|
-
xXe: '8b',
|
|
274
|
-
xcyan: '8b8b',
|
|
275
|
-
xgTMnPd: 'b8860b',
|
|
276
|
-
xWay: 'a9a9a9',
|
|
277
|
-
xgYF: '6400',
|
|
278
|
-
xgYy: 'a9a9a9',
|
|
279
|
-
xkhaki: 'bdb76b',
|
|
280
|
-
xmagFta: '8b008b',
|
|
281
|
-
xTivegYF: '556b2f',
|
|
282
|
-
xSange: 'ff8c00',
|
|
283
|
-
xScEd: '9932cc',
|
|
284
|
-
xYd: '8b0000',
|
|
285
|
-
xsOmon: 'e9967a',
|
|
286
|
-
xsHgYF: '8fbc8f',
|
|
287
|
-
xUXe: '483d8b',
|
|
288
|
-
xUWay: '2f4f4f',
|
|
289
|
-
xUgYy: '2f4f4f',
|
|
290
|
-
xQe: 'ced1',
|
|
291
|
-
xviTet: '9400d3',
|
|
292
|
-
dAppRk: 'ff1493',
|
|
293
|
-
dApskyXe: 'bfff',
|
|
294
|
-
dimWay: '696969',
|
|
295
|
-
dimgYy: '696969',
|
|
296
|
-
dodgerXe: '1e90ff',
|
|
297
|
-
fiYbrick: 'b22222',
|
|
298
|
-
flSOwEte: 'fffaf0',
|
|
299
|
-
foYstWAn: '228b22',
|
|
300
|
-
fuKsia: 'ff00ff',
|
|
301
|
-
gaRsbSo: 'dcdcdc',
|
|
302
|
-
ghostwEte: 'f8f8ff',
|
|
303
|
-
gTd: 'ffd700',
|
|
304
|
-
gTMnPd: 'daa520',
|
|
305
|
-
Way: '808080',
|
|
306
|
-
gYF: '8000',
|
|
307
|
-
gYFLw: 'adff2f',
|
|
308
|
-
gYy: '808080',
|
|
309
|
-
honeyMw: 'f0fff0',
|
|
310
|
-
hotpRk: 'ff69b4',
|
|
311
|
-
RdianYd: 'cd5c5c',
|
|
312
|
-
Rdigo: '4b0082',
|
|
313
|
-
ivSy: 'fffff0',
|
|
314
|
-
khaki: 'f0e68c',
|
|
315
|
-
lavFMr: 'e6e6fa',
|
|
316
|
-
lavFMrXsh: 'fff0f5',
|
|
317
|
-
lawngYF: '7cfc00',
|
|
318
|
-
NmoncEffon: 'fffacd',
|
|
319
|
-
ZXe: 'add8e6',
|
|
320
|
-
ZcSO: 'f08080',
|
|
321
|
-
Zcyan: 'e0ffff',
|
|
322
|
-
ZgTMnPdLw: 'fafad2',
|
|
323
|
-
ZWay: 'd3d3d3',
|
|
324
|
-
ZgYF: '90ee90',
|
|
325
|
-
ZgYy: 'd3d3d3',
|
|
326
|
-
ZpRk: 'ffb6c1',
|
|
327
|
-
ZsOmon: 'ffa07a',
|
|
328
|
-
ZsHgYF: '20b2aa',
|
|
329
|
-
ZskyXe: '87cefa',
|
|
330
|
-
ZUWay: '778899',
|
|
331
|
-
ZUgYy: '778899',
|
|
332
|
-
ZstAlXe: 'b0c4de',
|
|
333
|
-
ZLw: 'ffffe0',
|
|
334
|
-
lime: 'ff00',
|
|
335
|
-
limegYF: '32cd32',
|
|
336
|
-
lRF: 'faf0e6',
|
|
337
|
-
magFta: 'ff00ff',
|
|
338
|
-
maPon: '800000',
|
|
339
|
-
VaquamarRe: '66cdaa',
|
|
340
|
-
VXe: 'cd',
|
|
341
|
-
VScEd: 'ba55d3',
|
|
342
|
-
VpurpN: '9370db',
|
|
343
|
-
VsHgYF: '3cb371',
|
|
344
|
-
VUXe: '7b68ee',
|
|
345
|
-
VsprRggYF: 'fa9a',
|
|
346
|
-
VQe: '48d1cc',
|
|
347
|
-
VviTetYd: 'c71585',
|
|
348
|
-
midnightXe: '191970',
|
|
349
|
-
mRtcYam: 'f5fffa',
|
|
350
|
-
mistyPse: 'ffe4e1',
|
|
351
|
-
moccasR: 'ffe4b5',
|
|
352
|
-
navajowEte: 'ffdead',
|
|
353
|
-
navy: '80',
|
|
354
|
-
Tdlace: 'fdf5e6',
|
|
355
|
-
Tive: '808000',
|
|
356
|
-
TivedBb: '6b8e23',
|
|
357
|
-
Sange: 'ffa500',
|
|
358
|
-
SangeYd: 'ff4500',
|
|
359
|
-
ScEd: 'da70d6',
|
|
360
|
-
pOegTMnPd: 'eee8aa',
|
|
361
|
-
pOegYF: '98fb98',
|
|
362
|
-
pOeQe: 'afeeee',
|
|
363
|
-
pOeviTetYd: 'db7093',
|
|
364
|
-
papayawEp: 'ffefd5',
|
|
365
|
-
pHKpuff: 'ffdab9',
|
|
366
|
-
peru: 'cd853f',
|
|
367
|
-
pRk: 'ffc0cb',
|
|
368
|
-
plum: 'dda0dd',
|
|
369
|
-
powMrXe: 'b0e0e6',
|
|
370
|
-
purpN: '800080',
|
|
371
|
-
YbeccapurpN: '663399',
|
|
372
|
-
Yd: 'ff0000',
|
|
373
|
-
Psybrown: 'bc8f8f',
|
|
374
|
-
PyOXe: '4169e1',
|
|
375
|
-
saddNbPwn: '8b4513',
|
|
376
|
-
sOmon: 'fa8072',
|
|
377
|
-
sandybPwn: 'f4a460',
|
|
378
|
-
sHgYF: '2e8b57',
|
|
379
|
-
sHshell: 'fff5ee',
|
|
380
|
-
siFna: 'a0522d',
|
|
381
|
-
silver: 'c0c0c0',
|
|
382
|
-
skyXe: '87ceeb',
|
|
383
|
-
UXe: '6a5acd',
|
|
384
|
-
UWay: '708090',
|
|
385
|
-
UgYy: '708090',
|
|
386
|
-
snow: 'fffafa',
|
|
387
|
-
sprRggYF: 'ff7f',
|
|
388
|
-
stAlXe: '4682b4',
|
|
389
|
-
tan: 'd2b48c',
|
|
390
|
-
teO: '8080',
|
|
391
|
-
tEstN: 'd8bfd8',
|
|
392
|
-
tomato: 'ff6347',
|
|
393
|
-
Qe: '40e0d0',
|
|
394
|
-
viTet: 'ee82ee',
|
|
395
|
-
JHt: 'f5deb3',
|
|
396
|
-
wEte: 'ffffff',
|
|
397
|
-
wEtesmoke: 'f5f5f5',
|
|
398
|
-
Lw: 'ffff00',
|
|
399
|
-
LwgYF: '9acd32'
|
|
400
|
-
});
|
|
401
404
|
|
|
402
|
-
names
|
|
405
|
+
let names$1;
|
|
403
406
|
function nameParse(str) {
|
|
404
|
-
|
|
407
|
+
if (!names$1) {
|
|
408
|
+
names$1 = unpack();
|
|
409
|
+
names$1.transparent = [0, 0, 0, 0];
|
|
410
|
+
}
|
|
411
|
+
const a = names$1[str.toLowerCase()];
|
|
405
412
|
return a && {
|
|
406
413
|
r: a[0],
|
|
407
414
|
g: a[1],
|
|
@@ -473,13 +480,13 @@ class Color {
|
|
|
473
480
|
this._rgb = fromObject(obj);
|
|
474
481
|
}
|
|
475
482
|
rgbString() {
|
|
476
|
-
return rgbString(this._rgb);
|
|
483
|
+
return this._valid ? rgbString(this._rgb) : this._rgb;
|
|
477
484
|
}
|
|
478
485
|
hexString() {
|
|
479
|
-
return hexString(this._rgb);
|
|
486
|
+
return this._valid ? hexString(this._rgb) : this._rgb;
|
|
480
487
|
}
|
|
481
488
|
hslString() {
|
|
482
|
-
return hslString(this._rgb);
|
|
489
|
+
return this._valid ? hslString(this._rgb) : this._rgb;
|
|
483
490
|
}
|
|
484
491
|
mix(color, weight) {
|
|
485
492
|
const me = this;
|
|
@@ -552,8 +559,9 @@ class Color {
|
|
|
552
559
|
}
|
|
553
560
|
}
|
|
554
561
|
|
|
555
|
-
function
|
|
562
|
+
function index_esm(input) {
|
|
556
563
|
return new Color(input);
|
|
557
564
|
}
|
|
558
565
|
|
|
559
|
-
export default
|
|
566
|
+
export default index_esm;
|
|
567
|
+
export { Color, b2n, b2p, hexParse, hexString, hsl2rgb, hslString, hsv2rgb, hueParse, hwb2rgb, n2b, n2p, nameParse, p2b, rgb2hsl, rgbParse, rgbString, rotate, round };
|
package/dist/color.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @kurkle/color v0.1.
|
|
2
|
+
* @kurkle/color v0.1.9
|
|
3
3
|
* https://github.com/kurkle/color#readme
|
|
4
4
|
* (c) 2020 Jukka Kurkela
|
|
5
5
|
* Released under the MIT License
|
|
@@ -209,205 +209,209 @@ function hslString(v) {
|
|
|
209
209
|
: `hsl(${h}, ${s}%, ${l}%)`;
|
|
210
210
|
}
|
|
211
211
|
|
|
212
|
-
|
|
212
|
+
const map$1 = {
|
|
213
213
|
x: 'dark',
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
214
|
+
Z: 'light',
|
|
215
|
+
Y: 're',
|
|
216
|
+
X: 'blu',
|
|
217
|
+
W: 'gr',
|
|
218
|
+
V: 'medium',
|
|
219
|
+
U: 'slate',
|
|
220
|
+
A: 'ee',
|
|
221
|
+
T: 'ol',
|
|
222
|
+
S: 'or',
|
|
223
|
+
B: 'ra',
|
|
224
|
+
C: 'lateg',
|
|
225
|
+
D: 'ights',
|
|
226
|
+
R: 'in',
|
|
227
|
+
Q: 'turquois',
|
|
228
|
+
E: 'hi',
|
|
229
|
+
P: 'ro',
|
|
230
|
+
O: 'al',
|
|
231
|
+
N: 'le',
|
|
232
|
+
M: 'de',
|
|
233
|
+
L: 'yello',
|
|
234
|
+
F: 'en',
|
|
235
|
+
K: 'ch',
|
|
236
|
+
G: 'arks',
|
|
237
|
+
H: 'ea',
|
|
238
|
+
I: 'ightg',
|
|
239
|
+
J: 'wh'
|
|
240
240
|
};
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
241
|
+
const names = {
|
|
242
|
+
OiceXe: 'f0f8ff',
|
|
243
|
+
antiquewEte: 'faebd7',
|
|
244
|
+
aqua: 'ffff',
|
|
245
|
+
aquamarRe: '7fffd4',
|
|
246
|
+
azuY: 'f0ffff',
|
|
247
|
+
beige: 'f5f5dc',
|
|
248
|
+
bisque: 'ffe4c4',
|
|
249
|
+
black: '0',
|
|
250
|
+
blanKedOmond: 'ffebcd',
|
|
251
|
+
Xe: 'ff',
|
|
252
|
+
XeviTet: '8a2be2',
|
|
253
|
+
bPwn: 'a52a2a',
|
|
254
|
+
burlywood: 'deb887',
|
|
255
|
+
caMtXe: '5f9ea0',
|
|
256
|
+
KartYuse: '7fff00',
|
|
257
|
+
KocTate: 'd2691e',
|
|
258
|
+
cSO: 'ff7f50',
|
|
259
|
+
cSnflowerXe: '6495ed',
|
|
260
|
+
cSnsilk: 'fff8dc',
|
|
261
|
+
crimson: 'dc143c',
|
|
262
|
+
cyan: 'ffff',
|
|
263
|
+
xXe: '8b',
|
|
264
|
+
xcyan: '8b8b',
|
|
265
|
+
xgTMnPd: 'b8860b',
|
|
266
|
+
xWay: 'a9a9a9',
|
|
267
|
+
xgYF: '6400',
|
|
268
|
+
xgYy: 'a9a9a9',
|
|
269
|
+
xkhaki: 'bdb76b',
|
|
270
|
+
xmagFta: '8b008b',
|
|
271
|
+
xTivegYF: '556b2f',
|
|
272
|
+
xSange: 'ff8c00',
|
|
273
|
+
xScEd: '9932cc',
|
|
274
|
+
xYd: '8b0000',
|
|
275
|
+
xsOmon: 'e9967a',
|
|
276
|
+
xsHgYF: '8fbc8f',
|
|
277
|
+
xUXe: '483d8b',
|
|
278
|
+
xUWay: '2f4f4f',
|
|
279
|
+
xUgYy: '2f4f4f',
|
|
280
|
+
xQe: 'ced1',
|
|
281
|
+
xviTet: '9400d3',
|
|
282
|
+
dAppRk: 'ff1493',
|
|
283
|
+
dApskyXe: 'bfff',
|
|
284
|
+
dimWay: '696969',
|
|
285
|
+
dimgYy: '696969',
|
|
286
|
+
dodgerXe: '1e90ff',
|
|
287
|
+
fiYbrick: 'b22222',
|
|
288
|
+
flSOwEte: 'fffaf0',
|
|
289
|
+
foYstWAn: '228b22',
|
|
290
|
+
fuKsia: 'ff00ff',
|
|
291
|
+
gaRsbSo: 'dcdcdc',
|
|
292
|
+
ghostwEte: 'f8f8ff',
|
|
293
|
+
gTd: 'ffd700',
|
|
294
|
+
gTMnPd: 'daa520',
|
|
295
|
+
Way: '808080',
|
|
296
|
+
gYF: '8000',
|
|
297
|
+
gYFLw: 'adff2f',
|
|
298
|
+
gYy: '808080',
|
|
299
|
+
honeyMw: 'f0fff0',
|
|
300
|
+
hotpRk: 'ff69b4',
|
|
301
|
+
RdianYd: 'cd5c5c',
|
|
302
|
+
Rdigo: '4b0082',
|
|
303
|
+
ivSy: 'fffff0',
|
|
304
|
+
khaki: 'f0e68c',
|
|
305
|
+
lavFMr: 'e6e6fa',
|
|
306
|
+
lavFMrXsh: 'fff0f5',
|
|
307
|
+
lawngYF: '7cfc00',
|
|
308
|
+
NmoncEffon: 'fffacd',
|
|
309
|
+
ZXe: 'add8e6',
|
|
310
|
+
ZcSO: 'f08080',
|
|
311
|
+
Zcyan: 'e0ffff',
|
|
312
|
+
ZgTMnPdLw: 'fafad2',
|
|
313
|
+
ZWay: 'd3d3d3',
|
|
314
|
+
ZgYF: '90ee90',
|
|
315
|
+
ZgYy: 'd3d3d3',
|
|
316
|
+
ZpRk: 'ffb6c1',
|
|
317
|
+
ZsOmon: 'ffa07a',
|
|
318
|
+
ZsHgYF: '20b2aa',
|
|
319
|
+
ZskyXe: '87cefa',
|
|
320
|
+
ZUWay: '778899',
|
|
321
|
+
ZUgYy: '778899',
|
|
322
|
+
ZstAlXe: 'b0c4de',
|
|
323
|
+
ZLw: 'ffffe0',
|
|
324
|
+
lime: 'ff00',
|
|
325
|
+
limegYF: '32cd32',
|
|
326
|
+
lRF: 'faf0e6',
|
|
327
|
+
magFta: 'ff00ff',
|
|
328
|
+
maPon: '800000',
|
|
329
|
+
VaquamarRe: '66cdaa',
|
|
330
|
+
VXe: 'cd',
|
|
331
|
+
VScEd: 'ba55d3',
|
|
332
|
+
VpurpN: '9370db',
|
|
333
|
+
VsHgYF: '3cb371',
|
|
334
|
+
VUXe: '7b68ee',
|
|
335
|
+
VsprRggYF: 'fa9a',
|
|
336
|
+
VQe: '48d1cc',
|
|
337
|
+
VviTetYd: 'c71585',
|
|
338
|
+
midnightXe: '191970',
|
|
339
|
+
mRtcYam: 'f5fffa',
|
|
340
|
+
mistyPse: 'ffe4e1',
|
|
341
|
+
moccasR: 'ffe4b5',
|
|
342
|
+
navajowEte: 'ffdead',
|
|
343
|
+
navy: '80',
|
|
344
|
+
Tdlace: 'fdf5e6',
|
|
345
|
+
Tive: '808000',
|
|
346
|
+
TivedBb: '6b8e23',
|
|
347
|
+
Sange: 'ffa500',
|
|
348
|
+
SangeYd: 'ff4500',
|
|
349
|
+
ScEd: 'da70d6',
|
|
350
|
+
pOegTMnPd: 'eee8aa',
|
|
351
|
+
pOegYF: '98fb98',
|
|
352
|
+
pOeQe: 'afeeee',
|
|
353
|
+
pOeviTetYd: 'db7093',
|
|
354
|
+
papayawEp: 'ffefd5',
|
|
355
|
+
pHKpuff: 'ffdab9',
|
|
356
|
+
peru: 'cd853f',
|
|
357
|
+
pRk: 'ffc0cb',
|
|
358
|
+
plum: 'dda0dd',
|
|
359
|
+
powMrXe: 'b0e0e6',
|
|
360
|
+
purpN: '800080',
|
|
361
|
+
YbeccapurpN: '663399',
|
|
362
|
+
Yd: 'ff0000',
|
|
363
|
+
Psybrown: 'bc8f8f',
|
|
364
|
+
PyOXe: '4169e1',
|
|
365
|
+
saddNbPwn: '8b4513',
|
|
366
|
+
sOmon: 'fa8072',
|
|
367
|
+
sandybPwn: 'f4a460',
|
|
368
|
+
sHgYF: '2e8b57',
|
|
369
|
+
sHshell: 'fff5ee',
|
|
370
|
+
siFna: 'a0522d',
|
|
371
|
+
silver: 'c0c0c0',
|
|
372
|
+
skyXe: '87ceeb',
|
|
373
|
+
UXe: '6a5acd',
|
|
374
|
+
UWay: '708090',
|
|
375
|
+
UgYy: '708090',
|
|
376
|
+
snow: 'fffafa',
|
|
377
|
+
sprRggYF: 'ff7f',
|
|
378
|
+
stAlXe: '4682b4',
|
|
379
|
+
tan: 'd2b48c',
|
|
380
|
+
teO: '8080',
|
|
381
|
+
tEstN: 'd8bfd8',
|
|
382
|
+
tomato: 'ff6347',
|
|
383
|
+
Qe: '40e0d0',
|
|
384
|
+
viTet: 'ee82ee',
|
|
385
|
+
JHt: 'f5deb3',
|
|
386
|
+
wEte: 'ffffff',
|
|
387
|
+
wEtesmoke: 'f5f5f5',
|
|
388
|
+
Lw: 'ffff00',
|
|
389
|
+
LwgYF: '9acd32'
|
|
390
|
+
};
|
|
391
|
+
function unpack() {
|
|
392
|
+
const unpacked = {};
|
|
393
|
+
const keys = Object.keys(names);
|
|
394
|
+
const tkeys = Object.keys(map$1);
|
|
395
|
+
let i, j, k, ok, nk;
|
|
246
396
|
for (i = 0; i < keys.length; i++) {
|
|
247
397
|
ok = nk = keys[i];
|
|
248
398
|
for (j = 0; j < tkeys.length; j++) {
|
|
249
399
|
k = tkeys[j];
|
|
250
400
|
nk = nk.replace(k, map$1[k]);
|
|
251
401
|
}
|
|
252
|
-
k = parseInt(
|
|
402
|
+
k = parseInt(names[ok], 16);
|
|
253
403
|
unpacked[nk] = [k >> 16 & 0xFF, k >> 8 & 0xFF, k & 0xFF];
|
|
254
404
|
}
|
|
255
405
|
return unpacked;
|
|
256
406
|
}
|
|
257
|
-
const names = unpack({
|
|
258
|
-
OiceXe: 'f0f8ff',
|
|
259
|
-
antiquewEte: 'faebd7',
|
|
260
|
-
aqua: 'ffff',
|
|
261
|
-
aquamarRe: '7fffd4',
|
|
262
|
-
azuY: 'f0ffff',
|
|
263
|
-
beige: 'f5f5dc',
|
|
264
|
-
bisque: 'ffe4c4',
|
|
265
|
-
black: '0',
|
|
266
|
-
blanKedOmond: 'ffebcd',
|
|
267
|
-
Xe: 'ff',
|
|
268
|
-
XeviTet: '8a2be2',
|
|
269
|
-
bPwn: 'a52a2a',
|
|
270
|
-
burlywood: 'deb887',
|
|
271
|
-
caMtXe: '5f9ea0',
|
|
272
|
-
KartYuse: '7fff00',
|
|
273
|
-
KocTate: 'd2691e',
|
|
274
|
-
cSO: 'ff7f50',
|
|
275
|
-
cSnflowerXe: '6495ed',
|
|
276
|
-
cSnsilk: 'fff8dc',
|
|
277
|
-
crimson: 'dc143c',
|
|
278
|
-
cyan: 'ffff',
|
|
279
|
-
xXe: '8b',
|
|
280
|
-
xcyan: '8b8b',
|
|
281
|
-
xgTMnPd: 'b8860b',
|
|
282
|
-
xWay: 'a9a9a9',
|
|
283
|
-
xgYF: '6400',
|
|
284
|
-
xgYy: 'a9a9a9',
|
|
285
|
-
xkhaki: 'bdb76b',
|
|
286
|
-
xmagFta: '8b008b',
|
|
287
|
-
xTivegYF: '556b2f',
|
|
288
|
-
xSange: 'ff8c00',
|
|
289
|
-
xScEd: '9932cc',
|
|
290
|
-
xYd: '8b0000',
|
|
291
|
-
xsOmon: 'e9967a',
|
|
292
|
-
xsHgYF: '8fbc8f',
|
|
293
|
-
xUXe: '483d8b',
|
|
294
|
-
xUWay: '2f4f4f',
|
|
295
|
-
xUgYy: '2f4f4f',
|
|
296
|
-
xQe: 'ced1',
|
|
297
|
-
xviTet: '9400d3',
|
|
298
|
-
dAppRk: 'ff1493',
|
|
299
|
-
dApskyXe: 'bfff',
|
|
300
|
-
dimWay: '696969',
|
|
301
|
-
dimgYy: '696969',
|
|
302
|
-
dodgerXe: '1e90ff',
|
|
303
|
-
fiYbrick: 'b22222',
|
|
304
|
-
flSOwEte: 'fffaf0',
|
|
305
|
-
foYstWAn: '228b22',
|
|
306
|
-
fuKsia: 'ff00ff',
|
|
307
|
-
gaRsbSo: 'dcdcdc',
|
|
308
|
-
ghostwEte: 'f8f8ff',
|
|
309
|
-
gTd: 'ffd700',
|
|
310
|
-
gTMnPd: 'daa520',
|
|
311
|
-
Way: '808080',
|
|
312
|
-
gYF: '8000',
|
|
313
|
-
gYFLw: 'adff2f',
|
|
314
|
-
gYy: '808080',
|
|
315
|
-
honeyMw: 'f0fff0',
|
|
316
|
-
hotpRk: 'ff69b4',
|
|
317
|
-
RdianYd: 'cd5c5c',
|
|
318
|
-
Rdigo: '4b0082',
|
|
319
|
-
ivSy: 'fffff0',
|
|
320
|
-
khaki: 'f0e68c',
|
|
321
|
-
lavFMr: 'e6e6fa',
|
|
322
|
-
lavFMrXsh: 'fff0f5',
|
|
323
|
-
lawngYF: '7cfc00',
|
|
324
|
-
NmoncEffon: 'fffacd',
|
|
325
|
-
ZXe: 'add8e6',
|
|
326
|
-
ZcSO: 'f08080',
|
|
327
|
-
Zcyan: 'e0ffff',
|
|
328
|
-
ZgTMnPdLw: 'fafad2',
|
|
329
|
-
ZWay: 'd3d3d3',
|
|
330
|
-
ZgYF: '90ee90',
|
|
331
|
-
ZgYy: 'd3d3d3',
|
|
332
|
-
ZpRk: 'ffb6c1',
|
|
333
|
-
ZsOmon: 'ffa07a',
|
|
334
|
-
ZsHgYF: '20b2aa',
|
|
335
|
-
ZskyXe: '87cefa',
|
|
336
|
-
ZUWay: '778899',
|
|
337
|
-
ZUgYy: '778899',
|
|
338
|
-
ZstAlXe: 'b0c4de',
|
|
339
|
-
ZLw: 'ffffe0',
|
|
340
|
-
lime: 'ff00',
|
|
341
|
-
limegYF: '32cd32',
|
|
342
|
-
lRF: 'faf0e6',
|
|
343
|
-
magFta: 'ff00ff',
|
|
344
|
-
maPon: '800000',
|
|
345
|
-
VaquamarRe: '66cdaa',
|
|
346
|
-
VXe: 'cd',
|
|
347
|
-
VScEd: 'ba55d3',
|
|
348
|
-
VpurpN: '9370db',
|
|
349
|
-
VsHgYF: '3cb371',
|
|
350
|
-
VUXe: '7b68ee',
|
|
351
|
-
VsprRggYF: 'fa9a',
|
|
352
|
-
VQe: '48d1cc',
|
|
353
|
-
VviTetYd: 'c71585',
|
|
354
|
-
midnightXe: '191970',
|
|
355
|
-
mRtcYam: 'f5fffa',
|
|
356
|
-
mistyPse: 'ffe4e1',
|
|
357
|
-
moccasR: 'ffe4b5',
|
|
358
|
-
navajowEte: 'ffdead',
|
|
359
|
-
navy: '80',
|
|
360
|
-
Tdlace: 'fdf5e6',
|
|
361
|
-
Tive: '808000',
|
|
362
|
-
TivedBb: '6b8e23',
|
|
363
|
-
Sange: 'ffa500',
|
|
364
|
-
SangeYd: 'ff4500',
|
|
365
|
-
ScEd: 'da70d6',
|
|
366
|
-
pOegTMnPd: 'eee8aa',
|
|
367
|
-
pOegYF: '98fb98',
|
|
368
|
-
pOeQe: 'afeeee',
|
|
369
|
-
pOeviTetYd: 'db7093',
|
|
370
|
-
papayawEp: 'ffefd5',
|
|
371
|
-
pHKpuff: 'ffdab9',
|
|
372
|
-
peru: 'cd853f',
|
|
373
|
-
pRk: 'ffc0cb',
|
|
374
|
-
plum: 'dda0dd',
|
|
375
|
-
powMrXe: 'b0e0e6',
|
|
376
|
-
purpN: '800080',
|
|
377
|
-
YbeccapurpN: '663399',
|
|
378
|
-
Yd: 'ff0000',
|
|
379
|
-
Psybrown: 'bc8f8f',
|
|
380
|
-
PyOXe: '4169e1',
|
|
381
|
-
saddNbPwn: '8b4513',
|
|
382
|
-
sOmon: 'fa8072',
|
|
383
|
-
sandybPwn: 'f4a460',
|
|
384
|
-
sHgYF: '2e8b57',
|
|
385
|
-
sHshell: 'fff5ee',
|
|
386
|
-
siFna: 'a0522d',
|
|
387
|
-
silver: 'c0c0c0',
|
|
388
|
-
skyXe: '87ceeb',
|
|
389
|
-
UXe: '6a5acd',
|
|
390
|
-
UWay: '708090',
|
|
391
|
-
UgYy: '708090',
|
|
392
|
-
snow: 'fffafa',
|
|
393
|
-
sprRggYF: 'ff7f',
|
|
394
|
-
stAlXe: '4682b4',
|
|
395
|
-
tan: 'd2b48c',
|
|
396
|
-
teO: '8080',
|
|
397
|
-
tEstN: 'd8bfd8',
|
|
398
|
-
tomato: 'ff6347',
|
|
399
|
-
Qe: '40e0d0',
|
|
400
|
-
viTet: 'ee82ee',
|
|
401
|
-
JHt: 'f5deb3',
|
|
402
|
-
wEte: 'ffffff',
|
|
403
|
-
wEtesmoke: 'f5f5f5',
|
|
404
|
-
Lw: 'ffff00',
|
|
405
|
-
LwgYF: '9acd32'
|
|
406
|
-
});
|
|
407
407
|
|
|
408
|
-
names
|
|
408
|
+
let names$1;
|
|
409
409
|
function nameParse(str) {
|
|
410
|
-
|
|
410
|
+
if (!names$1) {
|
|
411
|
+
names$1 = unpack();
|
|
412
|
+
names$1.transparent = [0, 0, 0, 0];
|
|
413
|
+
}
|
|
414
|
+
const a = names$1[str.toLowerCase()];
|
|
411
415
|
return a && {
|
|
412
416
|
r: a[0],
|
|
413
417
|
g: a[1],
|
|
@@ -479,13 +483,13 @@ class Color {
|
|
|
479
483
|
this._rgb = fromObject(obj);
|
|
480
484
|
}
|
|
481
485
|
rgbString() {
|
|
482
|
-
return rgbString(this._rgb);
|
|
486
|
+
return this._valid ? rgbString(this._rgb) : this._rgb;
|
|
483
487
|
}
|
|
484
488
|
hexString() {
|
|
485
|
-
return hexString(this._rgb);
|
|
489
|
+
return this._valid ? hexString(this._rgb) : this._rgb;
|
|
486
490
|
}
|
|
487
491
|
hslString() {
|
|
488
|
-
return hslString(this._rgb);
|
|
492
|
+
return this._valid ? hslString(this._rgb) : this._rgb;
|
|
489
493
|
}
|
|
490
494
|
mix(color, weight) {
|
|
491
495
|
const me = this;
|
package/dist/color.min.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @kurkle/color v0.1.
|
|
2
|
+
* @kurkle/color v0.1.9
|
|
3
3
|
* https://github.com/kurkle/color#readme
|
|
4
4
|
* (c) 2020 Jukka Kurkela
|
|
5
5
|
* Released under the MIT License
|
|
6
6
|
*/
|
|
7
|
-
!function(e,f){"object"==typeof exports&&"undefined"!=typeof module?module.exports=f():"function"==typeof define&&define.amd?define(f):(e=e||self)["@kurkle/color"]=f()}(this,(function(){"use strict";const e={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15,a:10,b:11,c:12,d:13,e:14,f:15},f="0123456789ABCDEF",t=e=>f[15&e],r=e=>f[(240&e)>>4]+f[15&e],a=e=>(240&e)>>4==(15&e);function n(e){var f=function(e){return a(e.r)&&a(e.g)&&a(e.b)&&a(e.a)}(e)?t:r;return e?"#"+f(e.r)+f(e.g)+f(e.b)+(e.a<255?f(e.a):""):e}function
|
|
7
|
+
!function(e,f){"object"==typeof exports&&"undefined"!=typeof module?module.exports=f():"function"==typeof define&&define.amd?define(f):(e=e||self)["@kurkle/color"]=f()}(this,(function(){"use strict";const e={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15,a:10,b:11,c:12,d:13,e:14,f:15},f="0123456789ABCDEF",t=e=>f[15&e],r=e=>f[(240&e)>>4]+f[15&e],a=e=>(240&e)>>4==(15&e);function n(e){var f=function(e){return a(e.r)&&a(e.g)&&a(e.b)&&a(e.a)}(e)?t:r;return e?"#"+f(e.r)+f(e.g)+f(e.b)+(e.a<255?f(e.a):""):e}function i(e){return e+.5|0}const s=(e,f,t)=>Math.max(Math.min(e,t),f);function c(e){return s(i(2.55*e),0,255)}function b(e){return s(i(255*e),0,255)}function d(e){return s(i(e/2.55)/100,0,1)}function g(e){return s(i(100*e),0,100)}const o=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;const u=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function h(e,f,t){const r=f*Math.min(t,1-t),a=(f,a=(f+e/30)%12)=>t-r*Math.max(Math.min(a-3,9-a,1),-1);return[a(0),a(8),a(4)]}function l(e,f,t){const r=(r,a=(r+e/60)%6)=>t-t*f*Math.max(Math.min(a,4-a,1),0);return[r(5),r(3),r(1)]}function m(e,f,t){const r=h(e,1,.5);let a;for(f+t>1&&(a=1/(f+t),f*=a,t*=a),a=0;a<3;a++)r[a]*=1-f-t,r[a]+=f;return r}function y(e){const f=e.r/255,t=e.g/255,r=e.b/255,a=Math.max(f,t,r),n=Math.min(f,t,r),i=(a+n)/2;let s,c,b;return a!==n&&(b=a-n,c=i>.5?b/(2-a-n):b/(a+n),s=a===f?(t-r)/b+(t<r?6:0):a===t?(r-f)/b+2:(f-t)/b+4,s=60*s+.5),[0|s,c||0,i]}function p(e,f,t,r){return(Array.isArray(f)?e(f[0],f[1],f[2]):e(f,t,r)).map(b)}function Y(e,f,t){return p(h,e,f,t)}function x(e){return(e%360+360)%360}function v(e){const f=u.exec(e);let t,r=255;if(!f)return;f[5]!==t&&(r=f[6]?c(+f[5]):b(+f[5]));const a=x(+f[2]),n=+f[3]/100,i=+f[4]/100;return t="hwb"===f[1]?function(e,f,t){return p(m,e,f,t)}(a,n,i):"hsv"===f[1]?function(e,f,t){return p(l,e,f,t)}(a,n,i):Y(a,n,i),{r:t[0],g:t[1],b:t[2],a:r}}const w={x:"dark",Z:"light",Y:"re",X:"blu",W:"gr",V:"medium",U:"slate",A:"ee",T:"ol",S:"or",B:"ra",C:"lateg",D:"ights",R:"in",Q:"turquois",E:"hi",P:"ro",O:"al",N:"le",M:"de",L:"yello",F:"en",K:"ch",G:"arks",H:"ea",I:"ightg",J:"wh"},F={OiceXe:"f0f8ff",antiquewEte:"faebd7",aqua:"ffff",aquamarRe:"7fffd4",azuY:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"0",blanKedOmond:"ffebcd",Xe:"ff",XeviTet:"8a2be2",bPwn:"a52a2a",burlywood:"deb887",caMtXe:"5f9ea0",KartYuse:"7fff00",KocTate:"d2691e",cSO:"ff7f50",cSnflowerXe:"6495ed",cSnsilk:"fff8dc",crimson:"dc143c",cyan:"ffff",xXe:"8b",xcyan:"8b8b",xgTMnPd:"b8860b",xWay:"a9a9a9",xgYF:"6400",xgYy:"a9a9a9",xkhaki:"bdb76b",xmagFta:"8b008b",xTivegYF:"556b2f",xSange:"ff8c00",xScEd:"9932cc",xYd:"8b0000",xsOmon:"e9967a",xsHgYF:"8fbc8f",xUXe:"483d8b",xUWay:"2f4f4f",xUgYy:"2f4f4f",xQe:"ced1",xviTet:"9400d3",dAppRk:"ff1493",dApskyXe:"bfff",dimWay:"696969",dimgYy:"696969",dodgerXe:"1e90ff",fiYbrick:"b22222",flSOwEte:"fffaf0",foYstWAn:"228b22",fuKsia:"ff00ff",gaRsbSo:"dcdcdc",ghostwEte:"f8f8ff",gTd:"ffd700",gTMnPd:"daa520",Way:"808080",gYF:"8000",gYFLw:"adff2f",gYy:"808080",honeyMw:"f0fff0",hotpRk:"ff69b4",RdianYd:"cd5c5c",Rdigo:"4b0082",ivSy:"fffff0",khaki:"f0e68c",lavFMr:"e6e6fa",lavFMrXsh:"fff0f5",lawngYF:"7cfc00",NmoncEffon:"fffacd",ZXe:"add8e6",ZcSO:"f08080",Zcyan:"e0ffff",ZgTMnPdLw:"fafad2",ZWay:"d3d3d3",ZgYF:"90ee90",ZgYy:"d3d3d3",ZpRk:"ffb6c1",ZsOmon:"ffa07a",ZsHgYF:"20b2aa",ZskyXe:"87cefa",ZUWay:"778899",ZUgYy:"778899",ZstAlXe:"b0c4de",ZLw:"ffffe0",lime:"ff00",limegYF:"32cd32",lRF:"faf0e6",magFta:"ff00ff",maPon:"800000",VaquamarRe:"66cdaa",VXe:"cd",VScEd:"ba55d3",VpurpN:"9370db",VsHgYF:"3cb371",VUXe:"7b68ee",VsprRggYF:"fa9a",VQe:"48d1cc",VviTetYd:"c71585",midnightXe:"191970",mRtcYam:"f5fffa",mistyPse:"ffe4e1",moccasR:"ffe4b5",navajowEte:"ffdead",navy:"80",Tdlace:"fdf5e6",Tive:"808000",TivedBb:"6b8e23",Sange:"ffa500",SangeYd:"ff4500",ScEd:"da70d6",pOegTMnPd:"eee8aa",pOegYF:"98fb98",pOeQe:"afeeee",pOeviTetYd:"db7093",papayawEp:"ffefd5",pHKpuff:"ffdab9",peru:"cd853f",pRk:"ffc0cb",plum:"dda0dd",powMrXe:"b0e0e6",purpN:"800080",YbeccapurpN:"663399",Yd:"ff0000",Psybrown:"bc8f8f",PyOXe:"4169e1",saddNbPwn:"8b4513",sOmon:"fa8072",sandybPwn:"f4a460",sHgYF:"2e8b57",sHshell:"fff5ee",siFna:"a0522d",silver:"c0c0c0",skyXe:"87ceeb",UXe:"6a5acd",UWay:"708090",UgYy:"708090",snow:"fffafa",sprRggYF:"ff7f",stAlXe:"4682b4",tan:"d2b48c",teO:"8080",tEstN:"d8bfd8",tomato:"ff6347",Qe:"40e0d0",viTet:"ee82ee",JHt:"f5deb3",wEte:"ffffff",wEtesmoke:"f5f5f5",Lw:"ffff00",LwgYF:"9acd32"};let _;function k(e){_||(_=function(){const e={},f=Object.keys(F),t=Object.keys(w);let r,a,n,i,s;for(r=0;r<f.length;r++){for(i=s=f[r],a=0;a<t.length;a++)n=t[a],s=s.replace(n,w[n]);n=parseInt(F[i],16),e[s]=[n>>16&255,n>>8&255,255&n]}return e}(),_.transparent=[0,0,0,0]);const f=_[e.toLowerCase()];return f&&{r:f[0],g:f[1],b:f[2],a:4===f.length?f[3]:255}}function X(e,f,t){if(e){let r=y(e);r[f]=Math.max(0,Math.min(r[f]+r[f]*t,0===f?360:1)),r=Y(r),e.r=r[0],e.g=r[1],e.b=r[2]}}function M(e,f){return e?Object.assign(f||{},e):e}function O(e){var f={r:0,g:0,b:0,a:255};return Array.isArray(e)?e.length>=3&&(f={r:e[0],g:e[1],b:e[2],a:255},e.length>3&&(f.a=b(e[3]))):(f=M(e,{r:0,g:0,b:0,a:1})).a=b(f.a),f}function S(e){return"r"===e.charAt(0)?function(e){const f=o.exec(e);let t,r,a,n=255;if(f){if(f[7]!==t){const e=+f[7];n=255&(f[8]?c(e):255*e)}return t=+f[1],r=+f[3],a=+f[5],t=255&(f[2]?c(t):t),r=255&(f[4]?c(r):r),a=255&(f[6]?c(a):a),{r:t,g:r,b:a,a:n}}}(e):v(e)}class T{constructor(f){if(f instanceof T)return f;const t=typeof f;let r;var a,n,i;"object"===t?r=O(f):"string"===t&&(i=(a=f).length,"#"===a[0]&&(4===i||5===i?n={r:255&17*e[a[1]],g:255&17*e[a[2]],b:255&17*e[a[3]],a:5===i?17*e[a[4]]:255}:7!==i&&9!==i||(n={r:e[a[1]]<<4|e[a[2]],g:e[a[3]]<<4|e[a[4]],b:e[a[5]]<<4|e[a[6]],a:9===i?e[a[7]]<<4|e[a[8]]:255})),r=n||k(f)||S(f)),this._rgb=r,this._valid=!!r}get valid(){return this._valid}get rgb(){var e=M(this._rgb);return e&&(e.a=d(e.a)),e}set rgb(e){this._rgb=O(e)}rgbString(){return this._valid?(e=this._rgb)&&(e.a<255?`rgba(${e.r}, ${e.g}, ${e.b}, ${d(e.a)})`:`rgb(${e.r}, ${e.g}, ${e.b})`):this._rgb;var e}hexString(){return this._valid?n(this._rgb):this._rgb}hslString(){return this._valid?function(e){if(!e)return;const f=y(e),t=f[0],r=g(f[1]),a=g(f[2]);return e.a<255?`hsla(${t}, ${r}%, ${a}%, ${d(e.a)})`:`hsl(${t}, ${r}%, ${a}%)`}(this._rgb):this._rgb}mix(e,f){const t=this;if(e){const r=t.rgb,a=e.rgb;let n;const i=f===n?.5:f,s=2*i-1,c=r.a-a.a,b=((s*c==-1?s:(s+c)/(1+s*c))+1)/2;n=1-b,r.r=255&b*r.r+n*a.r+.5,r.g=255&b*r.g+n*a.g+.5,r.b=255&b*r.b+n*a.b+.5,r.a=i*r.a+(1-i)*a.a,t.rgb=r}return t}clone(){return new T(this.rgb)}alpha(e){return this._rgb.a=b(e),this}clearer(e){return this._rgb.a*=1-e,this}greyscale(){const e=this._rgb,f=i(.3*e.r+.59*e.g+.11*e.b);return e.r=e.g=e.b=f,this}opaquer(e){return this._rgb.a*=1+e,this}negate(){const e=this._rgb;return e.r=255-e.r,e.g=255-e.g,e.b=255-e.b,this}lighten(e){return X(this._rgb,2,e),this}darken(e){return X(this._rgb,2,-e),this}saturate(e){return X(this._rgb,1,e),this}desaturate(e){return X(this._rgb,1,-e),this}rotate(e){return function(e,f){var t=y(e);t[0]=x(t[0]+f),t=Y(t),e.r=t[0],e.g=t[1],e.b=t[2]}(this._rgb,e),this}}return function(e){return new T(e)}}));
|
|
8
8
|
//# sourceMappingURL=color.min.js.map
|
package/package.json
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kurkle/color",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.9",
|
|
4
4
|
"description": "css color parsing, manupulation and conversion",
|
|
5
5
|
"main": "dist/color.js",
|
|
6
6
|
"module": "dist/color.esm.js",
|
|
7
7
|
"types": "dist/color.d.ts",
|
|
8
8
|
"scripts": {
|
|
9
|
+
"build": "node util/copy_dist.js && rollup -c",
|
|
10
|
+
"lint": "eslint src/*.js test/*.js util/*.js",
|
|
9
11
|
"test": "node test/index.js"
|
|
10
12
|
},
|
|
11
13
|
"repository": {
|
|
@@ -36,9 +38,7 @@
|
|
|
36
38
|
"homepage": "https://github.com/kurkle/color#readme",
|
|
37
39
|
"dependencies": {},
|
|
38
40
|
"devDependencies": {
|
|
39
|
-
"@rollup/plugin-typescript": "^3.0.0",
|
|
40
41
|
"assert": "^2.0.0",
|
|
41
|
-
"babel-eslint": "^10.0.2",
|
|
42
42
|
"benchmark": "^2.1.4",
|
|
43
43
|
"chartjs-color": "^2.4.1",
|
|
44
44
|
"chartjs-color-string": "^0.6.0",
|
|
@@ -50,26 +50,22 @@
|
|
|
50
50
|
"color-parser": "^0.1.0",
|
|
51
51
|
"color-string": "^1.5.3",
|
|
52
52
|
"csscolorparser": "^1.0.3",
|
|
53
|
-
"eslint": "^
|
|
54
|
-
"eslint-config-chartjs": "^0.
|
|
53
|
+
"eslint": "^7.2.0",
|
|
54
|
+
"eslint-config-chartjs": "^0.2.0",
|
|
55
55
|
"eslint-config-defaults": "^9.0.0",
|
|
56
|
-
"eslint-plugin-import": "^2.
|
|
57
|
-
"eslint-plugin-react": "^7.
|
|
58
|
-
"fs": "0.0.
|
|
59
|
-
"gulp": "^4.0.2",
|
|
60
|
-
"gulp-eslint": "^6.0.0",
|
|
56
|
+
"eslint-plugin-import": "^2.21.1",
|
|
57
|
+
"eslint-plugin-react": "^7.20.0",
|
|
58
|
+
"fs": "0.0.1-security",
|
|
61
59
|
"perf_hooks": "0.0.1",
|
|
62
|
-
"rollup": "^
|
|
60
|
+
"rollup": "^2.15.0",
|
|
63
61
|
"rollup-plugin-cleanup": "^3.1.1",
|
|
64
|
-
"rollup-plugin-commonjs": "^10.0.2",
|
|
65
62
|
"rollup-plugin-istanbul": "^2.0.1",
|
|
66
|
-
"rollup-plugin-
|
|
67
|
-
"rollup-plugin-
|
|
68
|
-
"rollup-plugin-visualizer": "^3.3.1",
|
|
63
|
+
"rollup-plugin-terser": "^6.1.0",
|
|
64
|
+
"rollup-plugin-visualizer": "^4.0.4",
|
|
69
65
|
"tinycolor2": "^1.4.1",
|
|
70
|
-
"typedoc": "^0.
|
|
71
|
-
"typedoc-plugin-external-module-name": "^
|
|
72
|
-
"typescript": "^3.
|
|
73
|
-
"util": "^0.12.
|
|
66
|
+
"typedoc": "^0.17.7",
|
|
67
|
+
"typedoc-plugin-external-module-name": "^4.0.3",
|
|
68
|
+
"typescript": "^3.9.5",
|
|
69
|
+
"util": "^0.12.3"
|
|
74
70
|
}
|
|
75
71
|
}
|
package/dist/color.esm.min.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* @kurkle/color v0.1.5
|
|
3
|
-
* https://github.com/kurkle/color#readme
|
|
4
|
-
* (c) 2020 Jukka Kurkela
|
|
5
|
-
* Released under the MIT License
|
|
6
|
-
*/
|
|
7
|
-
/*!
|
|
8
|
-
* @kurkle/color v0.1.5
|
|
9
|
-
* https://github.com/kurkle/color#readme
|
|
10
|
-
* (c) 2020 Jukka Kurkela
|
|
11
|
-
* Released under the MIT License
|
|
12
|
-
*/
|
|
13
|
-
const e={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15,a:10,b:11,c:12,d:13,e:14,f:15},f="0123456789ABCDEF",t=e=>f[15&e],r=e=>f[(240&e)>>4]+f[15&e],a=e=>(240&e)>>4==(15&e);function n(e){var f=function(e){return a(e.r)&&a(e.g)&&a(e.b)&&a(e.a)}(e)?t:r;return e?"#"+f(e.r)+f(e.g)+f(e.b)+(e.a<255?f(e.a):""):e}function c(e){return e+.5|0}const s=(e,f,t)=>Math.max(Math.min(e,t),f);function i(e){return s(c(2.55*e),0,255)}function b(e){return s(c(255*e),0,255)}function g(e){return s(c(e/2.55)/100,0,1)}function d(e){return s(c(100*e),0,100)}const u=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;const o=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function h(e,f,t){const r=f*Math.min(t,1-t),a=(f,a=(f+e/30)%12)=>t-r*Math.max(Math.min(a-3,9-a,1),-1);return[a(0),a(8),a(4)]}function l(e,f,t){const r=(r,a=(r+e/60)%6)=>t-t*f*Math.max(Math.min(a,4-a,1),0);return[r(5),r(3),r(1)]}function m(e,f,t){const r=h(e,1,.5);let a;for(f+t>1&&(a=1/(f+t),f*=a,t*=a),a=0;a<3;a++)r[a]*=1-f-t,r[a]+=f;return r}function y(e){const f=e.r/255,t=e.g/255,r=e.b/255,a=Math.max(f,t,r),n=Math.min(f,t,r),c=(a+n)/2;let s,i,b;return a!==n&&(b=a-n,i=c>.5?b/(2-a-n):b/(a+n),s=a===f?(t-r)/b+(t<r?6:0):a===t?(r-f)/b+2:(f-t)/b+4,s=60*s+.5),[0|s,i||0,c]}function Y(e,f,t,r){return(Array.isArray(f)?e(f[0],f[1],f[2]):e(f,t,r)).map(b)}function p(e,f,t){return Y(h,e,f,t)}function x(e){return(e%360+360)%360}function v(e){const f=o.exec(e);let t,r=255;if(!f)return;f[5]!==t&&(r=f[6]?i(+f[5]):b(+f[5]));const a=x(+f[2]),n=+f[3]/100,c=+f[4]/100;return t="hwb"===f[1]?function(e,f,t){return Y(m,e,f,t)}(a,n,c):"hsv"===f[1]?function(e,f,t){return Y(l,e,f,t)}(a,n,c):p(a,n,c),{r:t[0],g:t[1],b:t[2],a:r}}var w={x:"dark",Z:"light",Y:"re",X:"blu",W:"gr",V:"medium",U:"slate",A:"ee",T:"ol",S:"or",B:"ra",C:"lateg",D:"ights",R:"in",Q:"turquois",E:"hi",P:"ro",O:"al",N:"le",M:"de",L:"yello",F:"en",K:"ch",G:"arks",H:"ea",I:"ightg",J:"wh"};const F=function(e){var f,t,r,a,n,c={},s=Object.keys(e),i=Object.keys(w);for(f=0;f<s.length;f++){for(a=n=s[f],t=0;t<i.length;t++)r=i[t],n=n.replace(r,w[r]);r=parseInt(e[a],16),c[n]=[r>>16&255,r>>8&255,255&r]}return c}({OiceXe:"f0f8ff",antiquewEte:"faebd7",aqua:"ffff",aquamarRe:"7fffd4",azuY:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"0",blanKedOmond:"ffebcd",Xe:"ff",XeviTet:"8a2be2",bPwn:"a52a2a",burlywood:"deb887",caMtXe:"5f9ea0",KartYuse:"7fff00",KocTate:"d2691e",cSO:"ff7f50",cSnflowerXe:"6495ed",cSnsilk:"fff8dc",crimson:"dc143c",cyan:"ffff",xXe:"8b",xcyan:"8b8b",xgTMnPd:"b8860b",xWay:"a9a9a9",xgYF:"6400",xgYy:"a9a9a9",xkhaki:"bdb76b",xmagFta:"8b008b",xTivegYF:"556b2f",xSange:"ff8c00",xScEd:"9932cc",xYd:"8b0000",xsOmon:"e9967a",xsHgYF:"8fbc8f",xUXe:"483d8b",xUWay:"2f4f4f",xUgYy:"2f4f4f",xQe:"ced1",xviTet:"9400d3",dAppRk:"ff1493",dApskyXe:"bfff",dimWay:"696969",dimgYy:"696969",dodgerXe:"1e90ff",fiYbrick:"b22222",flSOwEte:"fffaf0",foYstWAn:"228b22",fuKsia:"ff00ff",gaRsbSo:"dcdcdc",ghostwEte:"f8f8ff",gTd:"ffd700",gTMnPd:"daa520",Way:"808080",gYF:"8000",gYFLw:"adff2f",gYy:"808080",honeyMw:"f0fff0",hotpRk:"ff69b4",RdianYd:"cd5c5c",Rdigo:"4b0082",ivSy:"fffff0",khaki:"f0e68c",lavFMr:"e6e6fa",lavFMrXsh:"fff0f5",lawngYF:"7cfc00",NmoncEffon:"fffacd",ZXe:"add8e6",ZcSO:"f08080",Zcyan:"e0ffff",ZgTMnPdLw:"fafad2",ZWay:"d3d3d3",ZgYF:"90ee90",ZgYy:"d3d3d3",ZpRk:"ffb6c1",ZsOmon:"ffa07a",ZsHgYF:"20b2aa",ZskyXe:"87cefa",ZUWay:"778899",ZUgYy:"778899",ZstAlXe:"b0c4de",ZLw:"ffffe0",lime:"ff00",limegYF:"32cd32",lRF:"faf0e6",magFta:"ff00ff",maPon:"800000",VaquamarRe:"66cdaa",VXe:"cd",VScEd:"ba55d3",VpurpN:"9370db",VsHgYF:"3cb371",VUXe:"7b68ee",VsprRggYF:"fa9a",VQe:"48d1cc",VviTetYd:"c71585",midnightXe:"191970",mRtcYam:"f5fffa",mistyPse:"ffe4e1",moccasR:"ffe4b5",navajowEte:"ffdead",navy:"80",Tdlace:"fdf5e6",Tive:"808000",TivedBb:"6b8e23",Sange:"ffa500",SangeYd:"ff4500",ScEd:"da70d6",pOegTMnPd:"eee8aa",pOegYF:"98fb98",pOeQe:"afeeee",pOeviTetYd:"db7093",papayawEp:"ffefd5",pHKpuff:"ffdab9",peru:"cd853f",pRk:"ffc0cb",plum:"dda0dd",powMrXe:"b0e0e6",purpN:"800080",YbeccapurpN:"663399",Yd:"ff0000",Psybrown:"bc8f8f",PyOXe:"4169e1",saddNbPwn:"8b4513",sOmon:"fa8072",sandybPwn:"f4a460",sHgYF:"2e8b57",sHshell:"fff5ee",siFna:"a0522d",silver:"c0c0c0",skyXe:"87ceeb",UXe:"6a5acd",UWay:"708090",UgYy:"708090",snow:"fffafa",sprRggYF:"ff7f",stAlXe:"4682b4",tan:"d2b48c",teO:"8080",tEstN:"d8bfd8",tomato:"ff6347",Qe:"40e0d0",viTet:"ee82ee",JHt:"f5deb3",wEte:"ffffff",wEtesmoke:"f5f5f5",Lw:"ffff00",LwgYF:"9acd32"});function X(e,f,t){if(e){let r=y(e);r[f]=Math.max(0,Math.min(r[f]+r[f]*t,0===f?360:1)),r=p(r),e.r=r[0],e.g=r[1],e.b=r[2]}}function M(e,f){return e?Object.assign(f||{},e):e}function k(e){var f={r:0,g:0,b:0,a:255};return Array.isArray(e)?e.length>=3&&(f={r:e[0],g:e[1],b:e[2],a:255},e.length>3&&(f.a=b(e[3]))):(f=M(e,{r:0,g:0,b:0,a:1})).a=b(f.a),f}function O(e){return"r"===e.charAt(0)?function(e){const f=u.exec(e);let t,r,a,n=255;if(f){if(f[7]!==t){const e=+f[7];n=255&(f[8]?i(e):255*e)}return t=+f[1],r=+f[3],a=+f[5],t=255&(f[2]?i(t):t),r=255&(f[4]?i(r):r),a=255&(f[6]?i(a):a),{r:t,g:r,b:a,a:n}}}(e):v(e)}F.transparent=[0,0,0,0];class _{constructor(f){if(f instanceof _)return f;const t=typeof f;let r;var a,n,c;"object"===t?r=k(f):"string"===t&&(c=(a=f).length,"#"===a[0]&&(4===c||5===c?n={r:255&17*e[a[1]],g:255&17*e[a[2]],b:255&17*e[a[3]],a:5===c?17*e[a[4]]:255}:7!==c&&9!==c||(n={r:e[a[1]]<<4|e[a[2]],g:e[a[3]]<<4|e[a[4]],b:e[a[5]]<<4|e[a[6]],a:9===c?e[a[7]]<<4|e[a[8]]:255})),r=n||function(e){var f=F[e];return f&&{r:f[0],g:f[1],b:f[2],a:4===f.length?f[3]:255}}(f)||O(f)),this._rgb=r,this._valid=!!r}get valid(){return this._valid}get rgb(){var e=M(this._rgb);return e&&(e.a=g(e.a)),e}set rgb(e){this._rgb=k(e)}rgbString(){return(e=this._rgb)&&(e.a<255?`rgba(${e.r}, ${e.g}, ${e.b}, ${g(e.a)})`:`rgb(${e.r}, ${e.g}, ${e.b})`);var e}hexString(){return n(this._rgb)}hslString(){return function(e){if(!e)return;const f=y(e),t=f[0],r=d(f[1]),a=d(f[2]);return e.a<255?`hsla(${t}, ${r}%, ${a}%, ${g(e.a)})`:`hsl(${t}, ${r}%, ${a}%)`}(this._rgb)}mix(e,f){const t=this;if(e){const r=t.rgb,a=e.rgb;let n;const c=f===n?.5:f,s=2*c-1,i=r.a-a.a,b=((s*i==-1?s:(s+i)/(1+s*i))+1)/2;n=1-b,r.r=255&b*r.r+n*a.r+.5,r.g=255&b*r.g+n*a.g+.5,r.b=255&b*r.b+n*a.b+.5,r.a=c*r.a+(1-c)*a.a,t.rgb=r}return t}clone(){return new _(this.rgb)}alpha(e){return this._rgb.a=b(e),this}clearer(e){return this._rgb.a*=1-e,this}greyscale(){const e=this._rgb,f=c(.3*e.r+.59*e.g+.11*e.b);return e.r=e.g=e.b=f,this}opaquer(e){return this._rgb.a*=1+e,this}negate(){const e=this._rgb;return e.r=255-e.r,e.g=255-e.g,e.b=255-e.b,this}lighten(e){return X(this._rgb,2,e),this}darken(e){return X(this._rgb,2,-e),this}saturate(e){return X(this._rgb,1,e),this}desaturate(e){return X(this._rgb,1,-e),this}rotate(e){return function(e,f){var t=y(e);t[0]=x(t[0]+f),t=p(t),e.r=t[0],e.g=t[1],e.b=t[2]}(this._rgb,e),this}}export default function(e){return new _(e)}
|
|
14
|
-
//# sourceMappingURL=color.esm.min.js.map
|