@kurkle/color 0.1.8 → 0.2.1
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/LICENSE.md +1 -1
- package/dist/color.esm.js +523 -497
- package/dist/color.js +523 -496
- package/dist/color.min.js +3 -3
- package/package.json +17 -19
package/dist/color.esm.js
CHANGED
|
@@ -1,563 +1,589 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @kurkle/color v0.1
|
|
2
|
+
* @kurkle/color v0.2.1
|
|
3
3
|
* https://github.com/kurkle/color#readme
|
|
4
|
-
* (c)
|
|
4
|
+
* (c) 2022 Jukka Kurkela
|
|
5
5
|
* Released under the MIT License
|
|
6
6
|
*/
|
|
7
|
-
const map = {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};
|
|
8
|
-
const hex = '0123456789ABCDEF';
|
|
9
|
-
const h1 = (b) => hex[b & 0xF];
|
|
10
|
-
const h2 = (b) => hex[(b & 0xF0) >> 4] + hex[b & 0xF];
|
|
11
|
-
const eq = (b) => (((b & 0xF0) >> 4) === (b & 0xF));
|
|
12
|
-
function isShort(v) {
|
|
13
|
-
return eq(v.r) && eq(v.g) && eq(v.b) && eq(v.a);
|
|
14
|
-
}
|
|
15
|
-
function hexParse(str) {
|
|
16
|
-
var len = str.length;
|
|
17
|
-
var ret;
|
|
18
|
-
if (str[0] === '#') {
|
|
19
|
-
if (len === 4 || len === 5) {
|
|
20
|
-
ret = {
|
|
21
|
-
r: 255 & map[str[1]] * 17,
|
|
22
|
-
g: 255 & map[str[2]] * 17,
|
|
23
|
-
b: 255 & map[str[3]] * 17,
|
|
24
|
-
a: len === 5 ? map[str[4]] * 17 : 255
|
|
25
|
-
};
|
|
26
|
-
} else if (len === 7 || len === 9) {
|
|
27
|
-
ret = {
|
|
28
|
-
r: map[str[1]] << 4 | map[str[2]],
|
|
29
|
-
g: map[str[3]] << 4 | map[str[4]],
|
|
30
|
-
b: map[str[5]] << 4 | map[str[6]],
|
|
31
|
-
a: len === 9 ? (map[str[7]] << 4 | map[str[8]]) : 255
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
return ret;
|
|
36
|
-
}
|
|
37
|
-
function hexString(v) {
|
|
38
|
-
var f = isShort(v) ? h1 : h2;
|
|
39
|
-
return v
|
|
40
|
-
? '#' + f(v.r) + f(v.g) + f(v.b) + (v.a < 255 ? f(v.a) : '')
|
|
41
|
-
: v;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
7
|
function round(v) {
|
|
45
|
-
|
|
8
|
+
return v + 0.5 | 0;
|
|
46
9
|
}
|
|
47
10
|
const lim = (v, l, h) => Math.max(Math.min(v, h), l);
|
|
48
11
|
function p2b(v) {
|
|
49
|
-
|
|
12
|
+
return lim(round(v * 2.55), 0, 255);
|
|
50
13
|
}
|
|
51
14
|
function b2p(v) {
|
|
52
|
-
|
|
15
|
+
return lim(round(v / 2.55), 0, 100);
|
|
53
16
|
}
|
|
54
17
|
function n2b(v) {
|
|
55
|
-
|
|
18
|
+
return lim(round(v * 255), 0, 255);
|
|
56
19
|
}
|
|
57
20
|
function b2n(v) {
|
|
58
|
-
|
|
21
|
+
return lim(round(v / 2.55) / 100, 0, 1);
|
|
59
22
|
}
|
|
60
23
|
function n2p(v) {
|
|
61
|
-
|
|
24
|
+
return lim(round(v * 100), 0, 100);
|
|
62
25
|
}
|
|
63
26
|
|
|
64
|
-
const
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
27
|
+
const map$1 = {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};
|
|
28
|
+
const hex = [...'0123456789ABCDEF'];
|
|
29
|
+
const h1 = b => hex[b & 0xF];
|
|
30
|
+
const h2 = b => hex[(b & 0xF0) >> 4] + hex[b & 0xF];
|
|
31
|
+
const eq = b => ((b & 0xF0) >> 4) === (b & 0xF);
|
|
32
|
+
const isShort = v => eq(v.r) && eq(v.g) && eq(v.b) && eq(v.a);
|
|
33
|
+
function hexParse(str) {
|
|
34
|
+
var len = str.length;
|
|
35
|
+
var ret;
|
|
36
|
+
if (str[0] === '#') {
|
|
37
|
+
if (len === 4 || len === 5) {
|
|
38
|
+
ret = {
|
|
39
|
+
r: 255 & map$1[str[1]] * 17,
|
|
40
|
+
g: 255 & map$1[str[2]] * 17,
|
|
41
|
+
b: 255 & map$1[str[3]] * 17,
|
|
42
|
+
a: len === 5 ? map$1[str[4]] * 17 : 255
|
|
43
|
+
};
|
|
44
|
+
} else if (len === 7 || len === 9) {
|
|
45
|
+
ret = {
|
|
46
|
+
r: map$1[str[1]] << 4 | map$1[str[2]],
|
|
47
|
+
g: map$1[str[3]] << 4 | map$1[str[4]],
|
|
48
|
+
b: map$1[str[5]] << 4 | map$1[str[6]],
|
|
49
|
+
a: len === 9 ? (map$1[str[7]] << 4 | map$1[str[8]]) : 255
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return ret;
|
|
88
54
|
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
55
|
+
const alpha = (a, f) => a < 255 ? f(a) : '';
|
|
56
|
+
function hexString(v) {
|
|
57
|
+
var f = isShort(v) ? h1 : h2;
|
|
58
|
+
return v
|
|
59
|
+
? '#' + f(v.r) + f(v.g) + f(v.b) + alpha(v.a, f)
|
|
60
|
+
: undefined;
|
|
95
61
|
}
|
|
96
62
|
|
|
97
63
|
const HUE_RE = /^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;
|
|
98
64
|
function hsl2rgbn(h, s, l) {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
65
|
+
const a = s * Math.min(l, 1 - l);
|
|
66
|
+
const f = (n, k = (n + h / 30) % 12) => l - a * Math.max(Math.min(k - 3, 9 - k, 1), -1);
|
|
67
|
+
return [f(0), f(8), f(4)];
|
|
102
68
|
}
|
|
103
69
|
function hsv2rgbn(h, s, v) {
|
|
104
|
-
|
|
105
|
-
|
|
70
|
+
const f = (n, k = (n + h / 60) % 6) => v - v * s * Math.max(Math.min(k, 4 - k, 1), 0);
|
|
71
|
+
return [f(5), f(3), f(1)];
|
|
106
72
|
}
|
|
107
73
|
function hwb2rgbn(h, w, b) {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
74
|
+
const rgb = hsl2rgbn(h, 1, 0.5);
|
|
75
|
+
let i;
|
|
76
|
+
if (w + b > 1) {
|
|
77
|
+
i = 1 / (w + b);
|
|
78
|
+
w *= i;
|
|
79
|
+
b *= i;
|
|
80
|
+
}
|
|
81
|
+
for (i = 0; i < 3; i++) {
|
|
82
|
+
rgb[i] *= 1 - w - b;
|
|
83
|
+
rgb[i] += w;
|
|
84
|
+
}
|
|
85
|
+
return rgb;
|
|
86
|
+
}
|
|
87
|
+
function hueValue(r, g, b, d, max) {
|
|
88
|
+
if (r === max) {
|
|
89
|
+
return ((g - b) / d) + (g < b ? 6 : 0);
|
|
90
|
+
}
|
|
91
|
+
if (g === max) {
|
|
92
|
+
return (b - r) / d + 2;
|
|
93
|
+
}
|
|
94
|
+
return (r - g) / d + 4;
|
|
120
95
|
}
|
|
121
96
|
function rgb2hsl(v) {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
: (r - g) / d + 4;
|
|
138
|
-
h = h * 60 + 0.5;
|
|
139
|
-
}
|
|
140
|
-
return [h | 0, s || 0, l];
|
|
97
|
+
const range = 255;
|
|
98
|
+
const r = v.r / range;
|
|
99
|
+
const g = v.g / range;
|
|
100
|
+
const b = v.b / range;
|
|
101
|
+
const max = Math.max(r, g, b);
|
|
102
|
+
const min = Math.min(r, g, b);
|
|
103
|
+
const l = (max + min) / 2;
|
|
104
|
+
let h, s, d;
|
|
105
|
+
if (max !== min) {
|
|
106
|
+
d = max - min;
|
|
107
|
+
s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
|
|
108
|
+
h = hueValue(r, g, b, d, max);
|
|
109
|
+
h = h * 60 + 0.5;
|
|
110
|
+
}
|
|
111
|
+
return [h | 0, s || 0, l];
|
|
141
112
|
}
|
|
142
113
|
function calln(f, a, b, c) {
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
114
|
+
return (
|
|
115
|
+
Array.isArray(a)
|
|
116
|
+
? f(a[0], a[1], a[2])
|
|
117
|
+
: f(a, b, c)
|
|
118
|
+
).map(n2b);
|
|
148
119
|
}
|
|
149
120
|
function hsl2rgb(h, s, l) {
|
|
150
|
-
|
|
121
|
+
return calln(hsl2rgbn, h, s, l);
|
|
151
122
|
}
|
|
152
123
|
function hwb2rgb(h, w, b) {
|
|
153
|
-
|
|
124
|
+
return calln(hwb2rgbn, h, w, b);
|
|
154
125
|
}
|
|
155
126
|
function hsv2rgb(h, s, v) {
|
|
156
|
-
|
|
127
|
+
return calln(hsv2rgbn, h, s, v);
|
|
157
128
|
}
|
|
158
129
|
function hue(h) {
|
|
159
|
-
|
|
130
|
+
return (h % 360 + 360) % 360;
|
|
160
131
|
}
|
|
161
132
|
function hueParse(str) {
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
133
|
+
const m = HUE_RE.exec(str);
|
|
134
|
+
let a = 255;
|
|
135
|
+
let v;
|
|
136
|
+
if (!m) {
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
if (m[5] !== v) {
|
|
140
|
+
a = m[6] ? p2b(+m[5]) : n2b(+m[5]);
|
|
141
|
+
}
|
|
142
|
+
const h = hue(+m[2]);
|
|
143
|
+
const p1 = +m[3] / 100;
|
|
144
|
+
const p2 = +m[4] / 100;
|
|
145
|
+
if (m[1] === 'hwb') {
|
|
146
|
+
v = hwb2rgb(h, p1, p2);
|
|
147
|
+
} else if (m[1] === 'hsv') {
|
|
148
|
+
v = hsv2rgb(h, p1, p2);
|
|
149
|
+
} else {
|
|
150
|
+
v = hsl2rgb(h, p1, p2);
|
|
151
|
+
}
|
|
152
|
+
return {
|
|
153
|
+
r: v[0],
|
|
154
|
+
g: v[1],
|
|
155
|
+
b: v[2],
|
|
156
|
+
a: a
|
|
157
|
+
};
|
|
187
158
|
}
|
|
188
159
|
function rotate(v, deg) {
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
160
|
+
var h = rgb2hsl(v);
|
|
161
|
+
h[0] = hue(h[0] + deg);
|
|
162
|
+
h = hsl2rgb(h);
|
|
163
|
+
v.r = h[0];
|
|
164
|
+
v.g = h[1];
|
|
165
|
+
v.b = h[2];
|
|
195
166
|
}
|
|
196
167
|
function hslString(v) {
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
168
|
+
if (!v) {
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
const a = rgb2hsl(v);
|
|
172
|
+
const h = a[0];
|
|
173
|
+
const s = n2p(a[1]);
|
|
174
|
+
const l = n2p(a[2]);
|
|
175
|
+
return v.a < 255
|
|
176
|
+
? `hsla(${h}, ${s}%, ${l}%, ${b2n(v.a)})`
|
|
177
|
+
: `hsl(${h}, ${s}%, ${l}%)`;
|
|
207
178
|
}
|
|
208
179
|
|
|
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
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
180
|
+
const map = {
|
|
181
|
+
x: 'dark',
|
|
182
|
+
Z: 'light',
|
|
183
|
+
Y: 're',
|
|
184
|
+
X: 'blu',
|
|
185
|
+
W: 'gr',
|
|
186
|
+
V: 'medium',
|
|
187
|
+
U: 'slate',
|
|
188
|
+
A: 'ee',
|
|
189
|
+
T: 'ol',
|
|
190
|
+
S: 'or',
|
|
191
|
+
B: 'ra',
|
|
192
|
+
C: 'lateg',
|
|
193
|
+
D: 'ights',
|
|
194
|
+
R: 'in',
|
|
195
|
+
Q: 'turquois',
|
|
196
|
+
E: 'hi',
|
|
197
|
+
P: 'ro',
|
|
198
|
+
O: 'al',
|
|
199
|
+
N: 'le',
|
|
200
|
+
M: 'de',
|
|
201
|
+
L: 'yello',
|
|
202
|
+
F: 'en',
|
|
203
|
+
K: 'ch',
|
|
204
|
+
G: 'arks',
|
|
205
|
+
H: 'ea',
|
|
206
|
+
I: 'ightg',
|
|
207
|
+
J: 'wh'
|
|
208
|
+
};
|
|
209
|
+
const names$1 = {
|
|
210
|
+
OiceXe: 'f0f8ff',
|
|
211
|
+
antiquewEte: 'faebd7',
|
|
212
|
+
aqua: 'ffff',
|
|
213
|
+
aquamarRe: '7fffd4',
|
|
214
|
+
azuY: 'f0ffff',
|
|
215
|
+
beige: 'f5f5dc',
|
|
216
|
+
bisque: 'ffe4c4',
|
|
217
|
+
black: '0',
|
|
218
|
+
blanKedOmond: 'ffebcd',
|
|
219
|
+
Xe: 'ff',
|
|
220
|
+
XeviTet: '8a2be2',
|
|
221
|
+
bPwn: 'a52a2a',
|
|
222
|
+
burlywood: 'deb887',
|
|
223
|
+
caMtXe: '5f9ea0',
|
|
224
|
+
KartYuse: '7fff00',
|
|
225
|
+
KocTate: 'd2691e',
|
|
226
|
+
cSO: 'ff7f50',
|
|
227
|
+
cSnflowerXe: '6495ed',
|
|
228
|
+
cSnsilk: 'fff8dc',
|
|
229
|
+
crimson: 'dc143c',
|
|
230
|
+
cyan: 'ffff',
|
|
231
|
+
xXe: '8b',
|
|
232
|
+
xcyan: '8b8b',
|
|
233
|
+
xgTMnPd: 'b8860b',
|
|
234
|
+
xWay: 'a9a9a9',
|
|
235
|
+
xgYF: '6400',
|
|
236
|
+
xgYy: 'a9a9a9',
|
|
237
|
+
xkhaki: 'bdb76b',
|
|
238
|
+
xmagFta: '8b008b',
|
|
239
|
+
xTivegYF: '556b2f',
|
|
240
|
+
xSange: 'ff8c00',
|
|
241
|
+
xScEd: '9932cc',
|
|
242
|
+
xYd: '8b0000',
|
|
243
|
+
xsOmon: 'e9967a',
|
|
244
|
+
xsHgYF: '8fbc8f',
|
|
245
|
+
xUXe: '483d8b',
|
|
246
|
+
xUWay: '2f4f4f',
|
|
247
|
+
xUgYy: '2f4f4f',
|
|
248
|
+
xQe: 'ced1',
|
|
249
|
+
xviTet: '9400d3',
|
|
250
|
+
dAppRk: 'ff1493',
|
|
251
|
+
dApskyXe: 'bfff',
|
|
252
|
+
dimWay: '696969',
|
|
253
|
+
dimgYy: '696969',
|
|
254
|
+
dodgerXe: '1e90ff',
|
|
255
|
+
fiYbrick: 'b22222',
|
|
256
|
+
flSOwEte: 'fffaf0',
|
|
257
|
+
foYstWAn: '228b22',
|
|
258
|
+
fuKsia: 'ff00ff',
|
|
259
|
+
gaRsbSo: 'dcdcdc',
|
|
260
|
+
ghostwEte: 'f8f8ff',
|
|
261
|
+
gTd: 'ffd700',
|
|
262
|
+
gTMnPd: 'daa520',
|
|
263
|
+
Way: '808080',
|
|
264
|
+
gYF: '8000',
|
|
265
|
+
gYFLw: 'adff2f',
|
|
266
|
+
gYy: '808080',
|
|
267
|
+
honeyMw: 'f0fff0',
|
|
268
|
+
hotpRk: 'ff69b4',
|
|
269
|
+
RdianYd: 'cd5c5c',
|
|
270
|
+
Rdigo: '4b0082',
|
|
271
|
+
ivSy: 'fffff0',
|
|
272
|
+
khaki: 'f0e68c',
|
|
273
|
+
lavFMr: 'e6e6fa',
|
|
274
|
+
lavFMrXsh: 'fff0f5',
|
|
275
|
+
lawngYF: '7cfc00',
|
|
276
|
+
NmoncEffon: 'fffacd',
|
|
277
|
+
ZXe: 'add8e6',
|
|
278
|
+
ZcSO: 'f08080',
|
|
279
|
+
Zcyan: 'e0ffff',
|
|
280
|
+
ZgTMnPdLw: 'fafad2',
|
|
281
|
+
ZWay: 'd3d3d3',
|
|
282
|
+
ZgYF: '90ee90',
|
|
283
|
+
ZgYy: 'd3d3d3',
|
|
284
|
+
ZpRk: 'ffb6c1',
|
|
285
|
+
ZsOmon: 'ffa07a',
|
|
286
|
+
ZsHgYF: '20b2aa',
|
|
287
|
+
ZskyXe: '87cefa',
|
|
288
|
+
ZUWay: '778899',
|
|
289
|
+
ZUgYy: '778899',
|
|
290
|
+
ZstAlXe: 'b0c4de',
|
|
291
|
+
ZLw: 'ffffe0',
|
|
292
|
+
lime: 'ff00',
|
|
293
|
+
limegYF: '32cd32',
|
|
294
|
+
lRF: 'faf0e6',
|
|
295
|
+
magFta: 'ff00ff',
|
|
296
|
+
maPon: '800000',
|
|
297
|
+
VaquamarRe: '66cdaa',
|
|
298
|
+
VXe: 'cd',
|
|
299
|
+
VScEd: 'ba55d3',
|
|
300
|
+
VpurpN: '9370db',
|
|
301
|
+
VsHgYF: '3cb371',
|
|
302
|
+
VUXe: '7b68ee',
|
|
303
|
+
VsprRggYF: 'fa9a',
|
|
304
|
+
VQe: '48d1cc',
|
|
305
|
+
VviTetYd: 'c71585',
|
|
306
|
+
midnightXe: '191970',
|
|
307
|
+
mRtcYam: 'f5fffa',
|
|
308
|
+
mistyPse: 'ffe4e1',
|
|
309
|
+
moccasR: 'ffe4b5',
|
|
310
|
+
navajowEte: 'ffdead',
|
|
311
|
+
navy: '80',
|
|
312
|
+
Tdlace: 'fdf5e6',
|
|
313
|
+
Tive: '808000',
|
|
314
|
+
TivedBb: '6b8e23',
|
|
315
|
+
Sange: 'ffa500',
|
|
316
|
+
SangeYd: 'ff4500',
|
|
317
|
+
ScEd: 'da70d6',
|
|
318
|
+
pOegTMnPd: 'eee8aa',
|
|
319
|
+
pOegYF: '98fb98',
|
|
320
|
+
pOeQe: 'afeeee',
|
|
321
|
+
pOeviTetYd: 'db7093',
|
|
322
|
+
papayawEp: 'ffefd5',
|
|
323
|
+
pHKpuff: 'ffdab9',
|
|
324
|
+
peru: 'cd853f',
|
|
325
|
+
pRk: 'ffc0cb',
|
|
326
|
+
plum: 'dda0dd',
|
|
327
|
+
powMrXe: 'b0e0e6',
|
|
328
|
+
purpN: '800080',
|
|
329
|
+
YbeccapurpN: '663399',
|
|
330
|
+
Yd: 'ff0000',
|
|
331
|
+
Psybrown: 'bc8f8f',
|
|
332
|
+
PyOXe: '4169e1',
|
|
333
|
+
saddNbPwn: '8b4513',
|
|
334
|
+
sOmon: 'fa8072',
|
|
335
|
+
sandybPwn: 'f4a460',
|
|
336
|
+
sHgYF: '2e8b57',
|
|
337
|
+
sHshell: 'fff5ee',
|
|
338
|
+
siFna: 'a0522d',
|
|
339
|
+
silver: 'c0c0c0',
|
|
340
|
+
skyXe: '87ceeb',
|
|
341
|
+
UXe: '6a5acd',
|
|
342
|
+
UWay: '708090',
|
|
343
|
+
UgYy: '708090',
|
|
344
|
+
snow: 'fffafa',
|
|
345
|
+
sprRggYF: 'ff7f',
|
|
346
|
+
stAlXe: '4682b4',
|
|
347
|
+
tan: 'd2b48c',
|
|
348
|
+
teO: '8080',
|
|
349
|
+
tEstN: 'd8bfd8',
|
|
350
|
+
tomato: 'ff6347',
|
|
351
|
+
Qe: '40e0d0',
|
|
352
|
+
viTet: 'ee82ee',
|
|
353
|
+
JHt: 'f5deb3',
|
|
354
|
+
wEte: 'ffffff',
|
|
355
|
+
wEtesmoke: 'f5f5f5',
|
|
356
|
+
Lw: 'ffff00',
|
|
357
|
+
LwgYF: '9acd32'
|
|
237
358
|
};
|
|
238
|
-
function unpack(
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
}
|
|
254
|
-
const names = unpack({
|
|
255
|
-
OiceXe: 'f0f8ff',
|
|
256
|
-
antiquewEte: 'faebd7',
|
|
257
|
-
aqua: 'ffff',
|
|
258
|
-
aquamarRe: '7fffd4',
|
|
259
|
-
azuY: 'f0ffff',
|
|
260
|
-
beige: 'f5f5dc',
|
|
261
|
-
bisque: 'ffe4c4',
|
|
262
|
-
black: '0',
|
|
263
|
-
blanKedOmond: 'ffebcd',
|
|
264
|
-
Xe: 'ff',
|
|
265
|
-
XeviTet: '8a2be2',
|
|
266
|
-
bPwn: 'a52a2a',
|
|
267
|
-
burlywood: 'deb887',
|
|
268
|
-
caMtXe: '5f9ea0',
|
|
269
|
-
KartYuse: '7fff00',
|
|
270
|
-
KocTate: 'd2691e',
|
|
271
|
-
cSO: 'ff7f50',
|
|
272
|
-
cSnflowerXe: '6495ed',
|
|
273
|
-
cSnsilk: 'fff8dc',
|
|
274
|
-
crimson: 'dc143c',
|
|
275
|
-
cyan: 'ffff',
|
|
276
|
-
xXe: '8b',
|
|
277
|
-
xcyan: '8b8b',
|
|
278
|
-
xgTMnPd: 'b8860b',
|
|
279
|
-
xWay: 'a9a9a9',
|
|
280
|
-
xgYF: '6400',
|
|
281
|
-
xgYy: 'a9a9a9',
|
|
282
|
-
xkhaki: 'bdb76b',
|
|
283
|
-
xmagFta: '8b008b',
|
|
284
|
-
xTivegYF: '556b2f',
|
|
285
|
-
xSange: 'ff8c00',
|
|
286
|
-
xScEd: '9932cc',
|
|
287
|
-
xYd: '8b0000',
|
|
288
|
-
xsOmon: 'e9967a',
|
|
289
|
-
xsHgYF: '8fbc8f',
|
|
290
|
-
xUXe: '483d8b',
|
|
291
|
-
xUWay: '2f4f4f',
|
|
292
|
-
xUgYy: '2f4f4f',
|
|
293
|
-
xQe: 'ced1',
|
|
294
|
-
xviTet: '9400d3',
|
|
295
|
-
dAppRk: 'ff1493',
|
|
296
|
-
dApskyXe: 'bfff',
|
|
297
|
-
dimWay: '696969',
|
|
298
|
-
dimgYy: '696969',
|
|
299
|
-
dodgerXe: '1e90ff',
|
|
300
|
-
fiYbrick: 'b22222',
|
|
301
|
-
flSOwEte: 'fffaf0',
|
|
302
|
-
foYstWAn: '228b22',
|
|
303
|
-
fuKsia: 'ff00ff',
|
|
304
|
-
gaRsbSo: 'dcdcdc',
|
|
305
|
-
ghostwEte: 'f8f8ff',
|
|
306
|
-
gTd: 'ffd700',
|
|
307
|
-
gTMnPd: 'daa520',
|
|
308
|
-
Way: '808080',
|
|
309
|
-
gYF: '8000',
|
|
310
|
-
gYFLw: 'adff2f',
|
|
311
|
-
gYy: '808080',
|
|
312
|
-
honeyMw: 'f0fff0',
|
|
313
|
-
hotpRk: 'ff69b4',
|
|
314
|
-
RdianYd: 'cd5c5c',
|
|
315
|
-
Rdigo: '4b0082',
|
|
316
|
-
ivSy: 'fffff0',
|
|
317
|
-
khaki: 'f0e68c',
|
|
318
|
-
lavFMr: 'e6e6fa',
|
|
319
|
-
lavFMrXsh: 'fff0f5',
|
|
320
|
-
lawngYF: '7cfc00',
|
|
321
|
-
NmoncEffon: 'fffacd',
|
|
322
|
-
ZXe: 'add8e6',
|
|
323
|
-
ZcSO: 'f08080',
|
|
324
|
-
Zcyan: 'e0ffff',
|
|
325
|
-
ZgTMnPdLw: 'fafad2',
|
|
326
|
-
ZWay: 'd3d3d3',
|
|
327
|
-
ZgYF: '90ee90',
|
|
328
|
-
ZgYy: 'd3d3d3',
|
|
329
|
-
ZpRk: 'ffb6c1',
|
|
330
|
-
ZsOmon: 'ffa07a',
|
|
331
|
-
ZsHgYF: '20b2aa',
|
|
332
|
-
ZskyXe: '87cefa',
|
|
333
|
-
ZUWay: '778899',
|
|
334
|
-
ZUgYy: '778899',
|
|
335
|
-
ZstAlXe: 'b0c4de',
|
|
336
|
-
ZLw: 'ffffe0',
|
|
337
|
-
lime: 'ff00',
|
|
338
|
-
limegYF: '32cd32',
|
|
339
|
-
lRF: 'faf0e6',
|
|
340
|
-
magFta: 'ff00ff',
|
|
341
|
-
maPon: '800000',
|
|
342
|
-
VaquamarRe: '66cdaa',
|
|
343
|
-
VXe: 'cd',
|
|
344
|
-
VScEd: 'ba55d3',
|
|
345
|
-
VpurpN: '9370db',
|
|
346
|
-
VsHgYF: '3cb371',
|
|
347
|
-
VUXe: '7b68ee',
|
|
348
|
-
VsprRggYF: 'fa9a',
|
|
349
|
-
VQe: '48d1cc',
|
|
350
|
-
VviTetYd: 'c71585',
|
|
351
|
-
midnightXe: '191970',
|
|
352
|
-
mRtcYam: 'f5fffa',
|
|
353
|
-
mistyPse: 'ffe4e1',
|
|
354
|
-
moccasR: 'ffe4b5',
|
|
355
|
-
navajowEte: 'ffdead',
|
|
356
|
-
navy: '80',
|
|
357
|
-
Tdlace: 'fdf5e6',
|
|
358
|
-
Tive: '808000',
|
|
359
|
-
TivedBb: '6b8e23',
|
|
360
|
-
Sange: 'ffa500',
|
|
361
|
-
SangeYd: 'ff4500',
|
|
362
|
-
ScEd: 'da70d6',
|
|
363
|
-
pOegTMnPd: 'eee8aa',
|
|
364
|
-
pOegYF: '98fb98',
|
|
365
|
-
pOeQe: 'afeeee',
|
|
366
|
-
pOeviTetYd: 'db7093',
|
|
367
|
-
papayawEp: 'ffefd5',
|
|
368
|
-
pHKpuff: 'ffdab9',
|
|
369
|
-
peru: 'cd853f',
|
|
370
|
-
pRk: 'ffc0cb',
|
|
371
|
-
plum: 'dda0dd',
|
|
372
|
-
powMrXe: 'b0e0e6',
|
|
373
|
-
purpN: '800080',
|
|
374
|
-
YbeccapurpN: '663399',
|
|
375
|
-
Yd: 'ff0000',
|
|
376
|
-
Psybrown: 'bc8f8f',
|
|
377
|
-
PyOXe: '4169e1',
|
|
378
|
-
saddNbPwn: '8b4513',
|
|
379
|
-
sOmon: 'fa8072',
|
|
380
|
-
sandybPwn: 'f4a460',
|
|
381
|
-
sHgYF: '2e8b57',
|
|
382
|
-
sHshell: 'fff5ee',
|
|
383
|
-
siFna: 'a0522d',
|
|
384
|
-
silver: 'c0c0c0',
|
|
385
|
-
skyXe: '87ceeb',
|
|
386
|
-
UXe: '6a5acd',
|
|
387
|
-
UWay: '708090',
|
|
388
|
-
UgYy: '708090',
|
|
389
|
-
snow: 'fffafa',
|
|
390
|
-
sprRggYF: 'ff7f',
|
|
391
|
-
stAlXe: '4682b4',
|
|
392
|
-
tan: 'd2b48c',
|
|
393
|
-
teO: '8080',
|
|
394
|
-
tEstN: 'd8bfd8',
|
|
395
|
-
tomato: 'ff6347',
|
|
396
|
-
Qe: '40e0d0',
|
|
397
|
-
viTet: 'ee82ee',
|
|
398
|
-
JHt: 'f5deb3',
|
|
399
|
-
wEte: 'ffffff',
|
|
400
|
-
wEtesmoke: 'f5f5f5',
|
|
401
|
-
Lw: 'ffff00',
|
|
402
|
-
LwgYF: '9acd32'
|
|
403
|
-
});
|
|
359
|
+
function unpack() {
|
|
360
|
+
const unpacked = {};
|
|
361
|
+
const keys = Object.keys(names$1);
|
|
362
|
+
const tkeys = Object.keys(map);
|
|
363
|
+
let i, j, k, ok, nk;
|
|
364
|
+
for (i = 0; i < keys.length; i++) {
|
|
365
|
+
ok = nk = keys[i];
|
|
366
|
+
for (j = 0; j < tkeys.length; j++) {
|
|
367
|
+
k = tkeys[j];
|
|
368
|
+
nk = nk.replace(k, map[k]);
|
|
369
|
+
}
|
|
370
|
+
k = parseInt(names$1[ok], 16);
|
|
371
|
+
unpacked[nk] = [k >> 16 & 0xFF, k >> 8 & 0xFF, k & 0xFF];
|
|
372
|
+
}
|
|
373
|
+
return unpacked;
|
|
374
|
+
}
|
|
404
375
|
|
|
405
|
-
names
|
|
376
|
+
let names;
|
|
406
377
|
function nameParse(str) {
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
378
|
+
if (!names) {
|
|
379
|
+
names = unpack();
|
|
380
|
+
names.transparent = [0, 0, 0, 0];
|
|
381
|
+
}
|
|
382
|
+
const a = names[str.toLowerCase()];
|
|
383
|
+
return a && {
|
|
384
|
+
r: a[0],
|
|
385
|
+
g: a[1],
|
|
386
|
+
b: a[2],
|
|
387
|
+
a: a.length === 4 ? a[3] : 255
|
|
388
|
+
};
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
const RGB_RE = /^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;
|
|
392
|
+
function rgbParse(str) {
|
|
393
|
+
const m = RGB_RE.exec(str);
|
|
394
|
+
let a = 255;
|
|
395
|
+
let r, g, b;
|
|
396
|
+
if (!m) {
|
|
397
|
+
return;
|
|
398
|
+
}
|
|
399
|
+
if (m[7] !== r) {
|
|
400
|
+
const v = +m[7];
|
|
401
|
+
a = m[8] ? p2b(v) : lim(v * 255, 0, 255);
|
|
402
|
+
}
|
|
403
|
+
r = +m[1];
|
|
404
|
+
g = +m[3];
|
|
405
|
+
b = +m[5];
|
|
406
|
+
r = 255 & (m[2] ? p2b(r) : lim(r, 0, 255));
|
|
407
|
+
g = 255 & (m[4] ? p2b(g) : lim(g, 0, 255));
|
|
408
|
+
b = 255 & (m[6] ? p2b(b) : lim(b, 0, 255));
|
|
409
|
+
return {
|
|
410
|
+
r: r,
|
|
411
|
+
g: g,
|
|
412
|
+
b: b,
|
|
413
|
+
a: a
|
|
414
|
+
};
|
|
415
|
+
}
|
|
416
|
+
function rgbString(v) {
|
|
417
|
+
return v && (
|
|
418
|
+
v.a < 255
|
|
419
|
+
? `rgba(${v.r}, ${v.g}, ${v.b}, ${b2n(v.a)})`
|
|
420
|
+
: `rgb(${v.r}, ${v.g}, ${v.b})`
|
|
421
|
+
);
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
const to = v => v <= 0.0031308 ? v * 12.92 : Math.pow(v, 1.0 / 2.4) * 1.055 - 0.055;
|
|
425
|
+
const from = v => v <= 0.04045 ? v / 12.92 : Math.pow((v + 0.055) / 1.055, 2.4);
|
|
426
|
+
function interpolate(rgb1, rgb2, t) {
|
|
427
|
+
const r = from(b2n(rgb1.r));
|
|
428
|
+
const g = from(b2n(rgb1.g));
|
|
429
|
+
const b = from(b2n(rgb1.b));
|
|
430
|
+
return {
|
|
431
|
+
r: n2b(to(r + t * (from(b2n(rgb2.r)) - r))),
|
|
432
|
+
g: n2b(to(g + t * (from(b2n(rgb2.g)) - g))),
|
|
433
|
+
b: n2b(to(b + t * (from(b2n(rgb2.b)) - b))),
|
|
434
|
+
a: rgb1.a + t * (rgb2.a - rgb1.a)
|
|
435
|
+
};
|
|
414
436
|
}
|
|
415
437
|
|
|
416
438
|
function modHSL(v, i, ratio) {
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
439
|
+
if (v) {
|
|
440
|
+
let tmp = rgb2hsl(v);
|
|
441
|
+
tmp[i] = Math.max(0, Math.min(tmp[i] + tmp[i] * ratio, i === 0 ? 360 : 1));
|
|
442
|
+
tmp = hsl2rgb(tmp);
|
|
443
|
+
v.r = tmp[0];
|
|
444
|
+
v.g = tmp[1];
|
|
445
|
+
v.b = tmp[2];
|
|
446
|
+
}
|
|
425
447
|
}
|
|
426
448
|
function clone(v, proto) {
|
|
427
|
-
|
|
449
|
+
return v ? Object.assign(proto || {}, v) : v;
|
|
428
450
|
}
|
|
429
451
|
function fromObject(input) {
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
452
|
+
var v = {r: 0, g: 0, b: 0, a: 255};
|
|
453
|
+
if (Array.isArray(input)) {
|
|
454
|
+
if (input.length >= 3) {
|
|
455
|
+
v = {r: input[0], g: input[1], b: input[2], a: 255};
|
|
456
|
+
if (input.length > 3) {
|
|
457
|
+
v.a = n2b(input[3]);
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
} else {
|
|
461
|
+
v = clone(input, {r: 0, g: 0, b: 0, a: 1});
|
|
462
|
+
v.a = n2b(v.a);
|
|
463
|
+
}
|
|
464
|
+
return v;
|
|
443
465
|
}
|
|
444
466
|
function functionParse(str) {
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
467
|
+
if (str.charAt(0) === 'r') {
|
|
468
|
+
return rgbParse(str);
|
|
469
|
+
}
|
|
470
|
+
return hueParse(str);
|
|
449
471
|
}
|
|
450
472
|
class Color {
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
473
|
+
constructor(input) {
|
|
474
|
+
if (input instanceof Color) {
|
|
475
|
+
return input;
|
|
476
|
+
}
|
|
477
|
+
const type = typeof input;
|
|
478
|
+
let v;
|
|
479
|
+
if (type === 'object') {
|
|
480
|
+
v = fromObject(input);
|
|
481
|
+
} else if (type === 'string') {
|
|
482
|
+
v = hexParse(input) || nameParse(input) || functionParse(input);
|
|
483
|
+
}
|
|
484
|
+
this._rgb = v;
|
|
485
|
+
this._valid = !!v;
|
|
486
|
+
}
|
|
487
|
+
get valid() {
|
|
488
|
+
return this._valid;
|
|
489
|
+
}
|
|
490
|
+
get rgb() {
|
|
491
|
+
var v = clone(this._rgb);
|
|
492
|
+
if (v) {
|
|
493
|
+
v.a = b2n(v.a);
|
|
494
|
+
}
|
|
495
|
+
return v;
|
|
496
|
+
}
|
|
497
|
+
set rgb(obj) {
|
|
498
|
+
this._rgb = fromObject(obj);
|
|
499
|
+
}
|
|
500
|
+
rgbString() {
|
|
501
|
+
return this._valid ? rgbString(this._rgb) : undefined;
|
|
502
|
+
}
|
|
503
|
+
hexString() {
|
|
504
|
+
return this._valid ? hexString(this._rgb) : undefined;
|
|
505
|
+
}
|
|
506
|
+
hslString() {
|
|
507
|
+
return this._valid ? hslString(this._rgb) : undefined;
|
|
508
|
+
}
|
|
509
|
+
mix(color, weight) {
|
|
510
|
+
if (color) {
|
|
511
|
+
const c1 = this.rgb;
|
|
512
|
+
const c2 = color.rgb;
|
|
513
|
+
let w2;
|
|
514
|
+
const p = weight === w2 ? 0.5 : weight;
|
|
515
|
+
const w = 2 * p - 1;
|
|
516
|
+
const a = c1.a - c2.a;
|
|
517
|
+
const w1 = ((w * a === -1 ? w : (w + a) / (1 + w * a)) + 1) / 2.0;
|
|
518
|
+
w2 = 1 - w1;
|
|
519
|
+
c1.r = 0xFF & w1 * c1.r + w2 * c2.r + 0.5;
|
|
520
|
+
c1.g = 0xFF & w1 * c1.g + w2 * c2.g + 0.5;
|
|
521
|
+
c1.b = 0xFF & w1 * c1.b + w2 * c2.b + 0.5;
|
|
522
|
+
c1.a = p * c1.a + (1 - p) * c2.a;
|
|
523
|
+
this.rgb = c1;
|
|
524
|
+
}
|
|
525
|
+
return this;
|
|
526
|
+
}
|
|
527
|
+
interpolate(color, t) {
|
|
528
|
+
if (color) {
|
|
529
|
+
this._rgb = interpolate(this._rgb, color._rgb, t);
|
|
530
|
+
}
|
|
531
|
+
return this;
|
|
532
|
+
}
|
|
533
|
+
clone() {
|
|
534
|
+
return new Color(this.rgb);
|
|
535
|
+
}
|
|
536
|
+
alpha(a) {
|
|
537
|
+
this._rgb.a = n2b(a);
|
|
538
|
+
return this;
|
|
539
|
+
}
|
|
540
|
+
clearer(ratio) {
|
|
541
|
+
const rgb = this._rgb;
|
|
542
|
+
rgb.a *= 1 - ratio;
|
|
543
|
+
return this;
|
|
544
|
+
}
|
|
545
|
+
greyscale() {
|
|
546
|
+
const rgb = this._rgb;
|
|
547
|
+
const val = round(rgb.r * 0.3 + rgb.g * 0.59 + rgb.b * 0.11);
|
|
548
|
+
rgb.r = rgb.g = rgb.b = val;
|
|
549
|
+
return this;
|
|
550
|
+
}
|
|
551
|
+
opaquer(ratio) {
|
|
552
|
+
const rgb = this._rgb;
|
|
553
|
+
rgb.a *= 1 + ratio;
|
|
554
|
+
return this;
|
|
555
|
+
}
|
|
556
|
+
negate() {
|
|
557
|
+
const v = this._rgb;
|
|
558
|
+
v.r = 255 - v.r;
|
|
559
|
+
v.g = 255 - v.g;
|
|
560
|
+
v.b = 255 - v.b;
|
|
561
|
+
return this;
|
|
562
|
+
}
|
|
563
|
+
lighten(ratio) {
|
|
564
|
+
modHSL(this._rgb, 2, ratio);
|
|
565
|
+
return this;
|
|
566
|
+
}
|
|
567
|
+
darken(ratio) {
|
|
568
|
+
modHSL(this._rgb, 2, -ratio);
|
|
569
|
+
return this;
|
|
570
|
+
}
|
|
571
|
+
saturate(ratio) {
|
|
572
|
+
modHSL(this._rgb, 1, ratio);
|
|
573
|
+
return this;
|
|
574
|
+
}
|
|
575
|
+
desaturate(ratio) {
|
|
576
|
+
modHSL(this._rgb, 1, -ratio);
|
|
577
|
+
return this;
|
|
578
|
+
}
|
|
579
|
+
rotate(deg) {
|
|
580
|
+
rotate(this._rgb, deg);
|
|
581
|
+
return this;
|
|
582
|
+
}
|
|
556
583
|
}
|
|
557
584
|
|
|
558
585
|
function index_esm(input) {
|
|
559
|
-
|
|
586
|
+
return new Color(input);
|
|
560
587
|
}
|
|
561
588
|
|
|
562
|
-
export default
|
|
563
|
-
export { Color, b2n, b2p, hexParse, hexString, hsl2rgb, hslString, hsv2rgb, hueParse, hwb2rgb, n2b, n2p, nameParse, p2b, rgb2hsl, rgbParse, rgbString, rotate, round };
|
|
589
|
+
export { Color, b2n, b2p, index_esm as default, hexParse, hexString, hsl2rgb, hslString, hsv2rgb, hueParse, hwb2rgb, lim, n2b, n2p, nameParse, p2b, rgb2hsl, rgbParse, rgbString, rotate, round };
|