funnel-gfx-wc 0.1.13 → 0.1.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{app-globals-3a1e7e63.js → app-globals-V2Kpy_OQ.js} +2 -0
- package/dist/cjs/app-globals-V2Kpy_OQ.js.map +1 -0
- package/dist/cjs/funnel-app.cjs.entry.js +1881 -1781
- package/dist/cjs/funnel-app.cjs.entry.js.map +1 -0
- package/dist/cjs/funnel-gfx-wc.cjs.js +8 -6
- package/dist/cjs/funnel-gfx-wc.cjs.js.map +1 -0
- package/dist/cjs/{index-44774964.js → index-ClfPW9fV.js} +12 -33
- package/dist/cjs/index-ClfPW9fV.js.map +1 -0
- package/dist/cjs/index.cjs.js +2 -0
- package/dist/cjs/index.cjs.js.map +1 -0
- package/dist/cjs/loader.cjs.js +4 -4
- package/dist/cjs/loader.cjs.js.map +1 -0
- package/dist/collection/collection-manifest.json +1 -1
- package/dist/collection/styles/shadow.css +1 -8
- package/dist/collection/tokens.css +1 -1
- package/dist/collection/utils/tw-version.js +1 -1
- package/dist/esm/{app-globals-0f993ce5.js → app-globals-DQuL1Twl.js} +2 -0
- package/dist/esm/app-globals-DQuL1Twl.js.map +1 -0
- package/dist/esm/funnel-app.entry.js +1881 -1779
- package/dist/esm/funnel-app.entry.js.map +1 -0
- package/dist/esm/funnel-gfx-wc.js +7 -4
- package/dist/esm/funnel-gfx-wc.js.map +1 -0
- package/dist/esm/{index-b958050a.js → index-Ds-wrPNa.js} +10 -11
- package/dist/esm/index-Ds-wrPNa.js.map +1 -0
- package/dist/esm/index.js +2 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/loader.js +5 -3
- package/dist/esm/loader.js.map +1 -0
- package/dist/funnel-gfx-wc/funnel-gfx-wc.esm.js +2 -1
- package/dist/funnel-gfx-wc/funnel-gfx-wc.esm.js.map +1 -0
- package/dist/funnel-gfx-wc/index.esm.js +2 -0
- package/dist/funnel-gfx-wc/index.esm.js.map +1 -0
- package/dist/funnel-gfx-wc/p-1074a7d4.entry.js +2 -0
- package/dist/funnel-gfx-wc/p-1074a7d4.entry.js.map +1 -0
- package/dist/funnel-gfx-wc/p-DQuL1Twl.js +2 -0
- package/dist/funnel-gfx-wc/p-DQuL1Twl.js.map +1 -0
- package/dist/funnel-gfx-wc/{p-19186959.js → p-Ds-wrPNa.js} +3 -2
- package/dist/funnel-gfx-wc/p-Ds-wrPNa.js.map +1 -0
- package/dist/funnel-gfx-wc/tokens.css +1 -1
- package/dist/types/stencil-public-runtime.d.ts +1 -0
- package/dist/types/utils/tw-version.d.ts +1 -1
- package/package.json +7 -7
- package/dist/funnel-gfx-wc/p-e1255160.js +0 -1
- package/dist/funnel-gfx-wc/p-ea0dddbf.entry.js +0 -1
- package/dist/loader/package.json +0 -11
- package/loader/package.json +0 -11
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { h, g as getRenderingRef, f as forceUpdate, r as registerInstance } from './index-
|
|
1
|
+
import { h, g as getRenderingRef, f as forceUpdate, r as registerInstance } from './index-Ds-wrPNa.js';
|
|
2
2
|
|
|
3
3
|
const Radio = props => {
|
|
4
4
|
const hex = props.hex || 'currentColor';
|
|
@@ -15,2129 +15,2221 @@ const Radio = props => {
|
|
|
15
15
|
|
|
16
16
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
18
|
+
function getDefaultExportFromCjs (x) {
|
|
19
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
var colorString$1 = {exports: {}};
|
|
23
|
+
|
|
24
|
+
var colorName$1;
|
|
25
|
+
var hasRequiredColorName$1;
|
|
26
|
+
|
|
27
|
+
function requireColorName$1 () {
|
|
28
|
+
if (hasRequiredColorName$1) return colorName$1;
|
|
29
|
+
hasRequiredColorName$1 = 1;
|
|
30
|
+
|
|
31
|
+
colorName$1 = {
|
|
32
|
+
"aliceblue": [240, 248, 255],
|
|
33
|
+
"antiquewhite": [250, 235, 215],
|
|
34
|
+
"aqua": [0, 255, 255],
|
|
35
|
+
"aquamarine": [127, 255, 212],
|
|
36
|
+
"azure": [240, 255, 255],
|
|
37
|
+
"beige": [245, 245, 220],
|
|
38
|
+
"bisque": [255, 228, 196],
|
|
39
|
+
"black": [0, 0, 0],
|
|
40
|
+
"blanchedalmond": [255, 235, 205],
|
|
41
|
+
"blue": [0, 0, 255],
|
|
42
|
+
"blueviolet": [138, 43, 226],
|
|
43
|
+
"brown": [165, 42, 42],
|
|
44
|
+
"burlywood": [222, 184, 135],
|
|
45
|
+
"cadetblue": [95, 158, 160],
|
|
46
|
+
"chartreuse": [127, 255, 0],
|
|
47
|
+
"chocolate": [210, 105, 30],
|
|
48
|
+
"coral": [255, 127, 80],
|
|
49
|
+
"cornflowerblue": [100, 149, 237],
|
|
50
|
+
"cornsilk": [255, 248, 220],
|
|
51
|
+
"crimson": [220, 20, 60],
|
|
52
|
+
"cyan": [0, 255, 255],
|
|
53
|
+
"darkblue": [0, 0, 139],
|
|
54
|
+
"darkcyan": [0, 139, 139],
|
|
55
|
+
"darkgoldenrod": [184, 134, 11],
|
|
56
|
+
"darkgray": [169, 169, 169],
|
|
57
|
+
"darkgreen": [0, 100, 0],
|
|
58
|
+
"darkgrey": [169, 169, 169],
|
|
59
|
+
"darkkhaki": [189, 183, 107],
|
|
60
|
+
"darkmagenta": [139, 0, 139],
|
|
61
|
+
"darkolivegreen": [85, 107, 47],
|
|
62
|
+
"darkorange": [255, 140, 0],
|
|
63
|
+
"darkorchid": [153, 50, 204],
|
|
64
|
+
"darkred": [139, 0, 0],
|
|
65
|
+
"darksalmon": [233, 150, 122],
|
|
66
|
+
"darkseagreen": [143, 188, 143],
|
|
67
|
+
"darkslateblue": [72, 61, 139],
|
|
68
|
+
"darkslategray": [47, 79, 79],
|
|
69
|
+
"darkslategrey": [47, 79, 79],
|
|
70
|
+
"darkturquoise": [0, 206, 209],
|
|
71
|
+
"darkviolet": [148, 0, 211],
|
|
72
|
+
"deeppink": [255, 20, 147],
|
|
73
|
+
"deepskyblue": [0, 191, 255],
|
|
74
|
+
"dimgray": [105, 105, 105],
|
|
75
|
+
"dimgrey": [105, 105, 105],
|
|
76
|
+
"dodgerblue": [30, 144, 255],
|
|
77
|
+
"firebrick": [178, 34, 34],
|
|
78
|
+
"floralwhite": [255, 250, 240],
|
|
79
|
+
"forestgreen": [34, 139, 34],
|
|
80
|
+
"fuchsia": [255, 0, 255],
|
|
81
|
+
"gainsboro": [220, 220, 220],
|
|
82
|
+
"ghostwhite": [248, 248, 255],
|
|
83
|
+
"gold": [255, 215, 0],
|
|
84
|
+
"goldenrod": [218, 165, 32],
|
|
85
|
+
"gray": [128, 128, 128],
|
|
86
|
+
"green": [0, 128, 0],
|
|
87
|
+
"greenyellow": [173, 255, 47],
|
|
88
|
+
"grey": [128, 128, 128],
|
|
89
|
+
"honeydew": [240, 255, 240],
|
|
90
|
+
"hotpink": [255, 105, 180],
|
|
91
|
+
"indianred": [205, 92, 92],
|
|
92
|
+
"indigo": [75, 0, 130],
|
|
93
|
+
"ivory": [255, 255, 240],
|
|
94
|
+
"khaki": [240, 230, 140],
|
|
95
|
+
"lavender": [230, 230, 250],
|
|
96
|
+
"lavenderblush": [255, 240, 245],
|
|
97
|
+
"lawngreen": [124, 252, 0],
|
|
98
|
+
"lemonchiffon": [255, 250, 205],
|
|
99
|
+
"lightblue": [173, 216, 230],
|
|
100
|
+
"lightcoral": [240, 128, 128],
|
|
101
|
+
"lightcyan": [224, 255, 255],
|
|
102
|
+
"lightgoldenrodyellow": [250, 250, 210],
|
|
103
|
+
"lightgray": [211, 211, 211],
|
|
104
|
+
"lightgreen": [144, 238, 144],
|
|
105
|
+
"lightgrey": [211, 211, 211],
|
|
106
|
+
"lightpink": [255, 182, 193],
|
|
107
|
+
"lightsalmon": [255, 160, 122],
|
|
108
|
+
"lightseagreen": [32, 178, 170],
|
|
109
|
+
"lightskyblue": [135, 206, 250],
|
|
110
|
+
"lightslategray": [119, 136, 153],
|
|
111
|
+
"lightslategrey": [119, 136, 153],
|
|
112
|
+
"lightsteelblue": [176, 196, 222],
|
|
113
|
+
"lightyellow": [255, 255, 224],
|
|
114
|
+
"lime": [0, 255, 0],
|
|
115
|
+
"limegreen": [50, 205, 50],
|
|
116
|
+
"linen": [250, 240, 230],
|
|
117
|
+
"magenta": [255, 0, 255],
|
|
118
|
+
"maroon": [128, 0, 0],
|
|
119
|
+
"mediumaquamarine": [102, 205, 170],
|
|
120
|
+
"mediumblue": [0, 0, 205],
|
|
121
|
+
"mediumorchid": [186, 85, 211],
|
|
122
|
+
"mediumpurple": [147, 112, 219],
|
|
123
|
+
"mediumseagreen": [60, 179, 113],
|
|
124
|
+
"mediumslateblue": [123, 104, 238],
|
|
125
|
+
"mediumspringgreen": [0, 250, 154],
|
|
126
|
+
"mediumturquoise": [72, 209, 204],
|
|
127
|
+
"mediumvioletred": [199, 21, 133],
|
|
128
|
+
"midnightblue": [25, 25, 112],
|
|
129
|
+
"mintcream": [245, 255, 250],
|
|
130
|
+
"mistyrose": [255, 228, 225],
|
|
131
|
+
"moccasin": [255, 228, 181],
|
|
132
|
+
"navajowhite": [255, 222, 173],
|
|
133
|
+
"navy": [0, 0, 128],
|
|
134
|
+
"oldlace": [253, 245, 230],
|
|
135
|
+
"olive": [128, 128, 0],
|
|
136
|
+
"olivedrab": [107, 142, 35],
|
|
137
|
+
"orange": [255, 165, 0],
|
|
138
|
+
"orangered": [255, 69, 0],
|
|
139
|
+
"orchid": [218, 112, 214],
|
|
140
|
+
"palegoldenrod": [238, 232, 170],
|
|
141
|
+
"palegreen": [152, 251, 152],
|
|
142
|
+
"paleturquoise": [175, 238, 238],
|
|
143
|
+
"palevioletred": [219, 112, 147],
|
|
144
|
+
"papayawhip": [255, 239, 213],
|
|
145
|
+
"peachpuff": [255, 218, 185],
|
|
146
|
+
"peru": [205, 133, 63],
|
|
147
|
+
"pink": [255, 192, 203],
|
|
148
|
+
"plum": [221, 160, 221],
|
|
149
|
+
"powderblue": [176, 224, 230],
|
|
150
|
+
"purple": [128, 0, 128],
|
|
151
|
+
"rebeccapurple": [102, 51, 153],
|
|
152
|
+
"red": [255, 0, 0],
|
|
153
|
+
"rosybrown": [188, 143, 143],
|
|
154
|
+
"royalblue": [65, 105, 225],
|
|
155
|
+
"saddlebrown": [139, 69, 19],
|
|
156
|
+
"salmon": [250, 128, 114],
|
|
157
|
+
"sandybrown": [244, 164, 96],
|
|
158
|
+
"seagreen": [46, 139, 87],
|
|
159
|
+
"seashell": [255, 245, 238],
|
|
160
|
+
"sienna": [160, 82, 45],
|
|
161
|
+
"silver": [192, 192, 192],
|
|
162
|
+
"skyblue": [135, 206, 235],
|
|
163
|
+
"slateblue": [106, 90, 205],
|
|
164
|
+
"slategray": [112, 128, 144],
|
|
165
|
+
"slategrey": [112, 128, 144],
|
|
166
|
+
"snow": [255, 250, 250],
|
|
167
|
+
"springgreen": [0, 255, 127],
|
|
168
|
+
"steelblue": [70, 130, 180],
|
|
169
|
+
"tan": [210, 180, 140],
|
|
170
|
+
"teal": [0, 128, 128],
|
|
171
|
+
"thistle": [216, 191, 216],
|
|
172
|
+
"tomato": [255, 99, 71],
|
|
173
|
+
"turquoise": [64, 224, 208],
|
|
174
|
+
"violet": [238, 130, 238],
|
|
175
|
+
"wheat": [245, 222, 179],
|
|
176
|
+
"white": [255, 255, 255],
|
|
177
|
+
"whitesmoke": [245, 245, 245],
|
|
178
|
+
"yellow": [255, 255, 0],
|
|
179
|
+
"yellowgreen": [154, 205, 50]
|
|
180
|
+
};
|
|
181
|
+
return colorName$1;
|
|
182
|
+
}
|
|
170
183
|
|
|
171
184
|
var simpleSwizzle = {exports: {}};
|
|
172
185
|
|
|
173
|
-
var isArrayish
|
|
174
|
-
|
|
175
|
-
return false;
|
|
176
|
-
}
|
|
186
|
+
var isArrayish;
|
|
187
|
+
var hasRequiredIsArrayish;
|
|
177
188
|
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
189
|
+
function requireIsArrayish () {
|
|
190
|
+
if (hasRequiredIsArrayish) return isArrayish;
|
|
191
|
+
hasRequiredIsArrayish = 1;
|
|
192
|
+
isArrayish = function isArrayish(obj) {
|
|
193
|
+
if (!obj || typeof obj === 'string') {
|
|
194
|
+
return false;
|
|
195
|
+
}
|
|
182
196
|
|
|
183
|
-
|
|
197
|
+
return obj instanceof Array || Array.isArray(obj) ||
|
|
198
|
+
(obj.length >= 0 && (obj.splice instanceof Function ||
|
|
199
|
+
(Object.getOwnPropertyDescriptor(obj, (obj.length - 1)) && obj.constructor.name !== 'String')));
|
|
200
|
+
};
|
|
201
|
+
return isArrayish;
|
|
202
|
+
}
|
|
184
203
|
|
|
185
|
-
var
|
|
186
|
-
var slice = Array.prototype.slice;
|
|
204
|
+
var hasRequiredSimpleSwizzle;
|
|
187
205
|
|
|
188
|
-
|
|
189
|
-
|
|
206
|
+
function requireSimpleSwizzle () {
|
|
207
|
+
if (hasRequiredSimpleSwizzle) return simpleSwizzle.exports;
|
|
208
|
+
hasRequiredSimpleSwizzle = 1;
|
|
190
209
|
|
|
191
|
-
|
|
192
|
-
var arg = args[i];
|
|
210
|
+
var isArrayish = requireIsArrayish();
|
|
193
211
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
212
|
+
var concat = Array.prototype.concat;
|
|
213
|
+
var slice = Array.prototype.slice;
|
|
214
|
+
|
|
215
|
+
var swizzle = simpleSwizzle.exports = function swizzle(args) {
|
|
216
|
+
var results = [];
|
|
217
|
+
|
|
218
|
+
for (var i = 0, len = args.length; i < len; i++) {
|
|
219
|
+
var arg = args[i];
|
|
220
|
+
|
|
221
|
+
if (isArrayish(arg)) {
|
|
222
|
+
// http://jsperf.com/javascript-array-concat-vs-push/98
|
|
223
|
+
results = concat.call(results, slice.call(arg));
|
|
224
|
+
} else {
|
|
225
|
+
results.push(arg);
|
|
226
|
+
}
|
|
199
227
|
}
|
|
200
|
-
}
|
|
201
228
|
|
|
202
|
-
|
|
203
|
-
};
|
|
229
|
+
return results;
|
|
230
|
+
};
|
|
204
231
|
|
|
205
|
-
swizzle
|
|
206
|
-
|
|
207
|
-
|
|
232
|
+
swizzle.wrap = function (fn) {
|
|
233
|
+
return function () {
|
|
234
|
+
return fn(swizzle(arguments));
|
|
235
|
+
};
|
|
208
236
|
};
|
|
209
|
-
|
|
237
|
+
return simpleSwizzle.exports;
|
|
238
|
+
}
|
|
210
239
|
|
|
211
240
|
/* MIT license */
|
|
212
241
|
|
|
213
|
-
var
|
|
214
|
-
var swizzle = simpleSwizzle.exports;
|
|
215
|
-
var hasOwnProperty = Object.hasOwnProperty;
|
|
242
|
+
var hasRequiredColorString;
|
|
216
243
|
|
|
217
|
-
|
|
244
|
+
function requireColorString () {
|
|
245
|
+
if (hasRequiredColorString) return colorString$1.exports;
|
|
246
|
+
hasRequiredColorString = 1;
|
|
247
|
+
var colorNames = requireColorName$1();
|
|
248
|
+
var swizzle = requireSimpleSwizzle();
|
|
249
|
+
var hasOwnProperty = Object.hasOwnProperty;
|
|
218
250
|
|
|
219
|
-
|
|
220
|
-
for (var name in colorNames) {
|
|
221
|
-
if (hasOwnProperty.call(colorNames, name)) {
|
|
222
|
-
reverseNames[colorNames[name]] = name;
|
|
223
|
-
}
|
|
224
|
-
}
|
|
251
|
+
var reverseNames = Object.create(null);
|
|
225
252
|
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
cs.get = function (string) {
|
|
232
|
-
var prefix = string.substring(0, 3).toLowerCase();
|
|
233
|
-
var val;
|
|
234
|
-
var model;
|
|
235
|
-
switch (prefix) {
|
|
236
|
-
case 'hsl':
|
|
237
|
-
val = cs.get.hsl(string);
|
|
238
|
-
model = 'hsl';
|
|
239
|
-
break;
|
|
240
|
-
case 'hwb':
|
|
241
|
-
val = cs.get.hwb(string);
|
|
242
|
-
model = 'hwb';
|
|
243
|
-
break;
|
|
244
|
-
default:
|
|
245
|
-
val = cs.get.rgb(string);
|
|
246
|
-
model = 'rgb';
|
|
247
|
-
break;
|
|
253
|
+
// create a list of reverse color names
|
|
254
|
+
for (var name in colorNames) {
|
|
255
|
+
if (hasOwnProperty.call(colorNames, name)) {
|
|
256
|
+
reverseNames[colorNames[name]] = name;
|
|
257
|
+
}
|
|
248
258
|
}
|
|
249
259
|
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
260
|
+
var cs = colorString$1.exports = {
|
|
261
|
+
to: {},
|
|
262
|
+
get: {}
|
|
263
|
+
};
|
|
253
264
|
|
|
254
|
-
|
|
255
|
-
|
|
265
|
+
cs.get = function (string) {
|
|
266
|
+
var prefix = string.substring(0, 3).toLowerCase();
|
|
267
|
+
var val;
|
|
268
|
+
var model;
|
|
269
|
+
switch (prefix) {
|
|
270
|
+
case 'hsl':
|
|
271
|
+
val = cs.get.hsl(string);
|
|
272
|
+
model = 'hsl';
|
|
273
|
+
break;
|
|
274
|
+
case 'hwb':
|
|
275
|
+
val = cs.get.hwb(string);
|
|
276
|
+
model = 'hwb';
|
|
277
|
+
break;
|
|
278
|
+
default:
|
|
279
|
+
val = cs.get.rgb(string);
|
|
280
|
+
model = 'rgb';
|
|
281
|
+
break;
|
|
282
|
+
}
|
|
256
283
|
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
}
|
|
284
|
+
if (!val) {
|
|
285
|
+
return null;
|
|
286
|
+
}
|
|
261
287
|
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
var rgba = /^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/;
|
|
265
|
-
var per = /^rgba?\(\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/;
|
|
266
|
-
var keyword = /^(\w+)$/;
|
|
288
|
+
return {model: model, value: val};
|
|
289
|
+
};
|
|
267
290
|
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
291
|
+
cs.get.rgb = function (string) {
|
|
292
|
+
if (!string) {
|
|
293
|
+
return null;
|
|
294
|
+
}
|
|
272
295
|
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
296
|
+
var abbr = /^#([a-f0-9]{3,4})$/i;
|
|
297
|
+
var hex = /^#([a-f0-9]{6})([a-f0-9]{2})?$/i;
|
|
298
|
+
var rgba = /^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/;
|
|
299
|
+
var per = /^rgba?\(\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/;
|
|
300
|
+
var keyword = /^(\w+)$/;
|
|
301
|
+
|
|
302
|
+
var rgb = [0, 0, 0, 1];
|
|
303
|
+
var match;
|
|
304
|
+
var i;
|
|
305
|
+
var hexAlpha;
|
|
306
|
+
|
|
307
|
+
if (match = string.match(hex)) {
|
|
308
|
+
hexAlpha = match[2];
|
|
309
|
+
match = match[1];
|
|
310
|
+
|
|
311
|
+
for (i = 0; i < 3; i++) {
|
|
312
|
+
// https://jsperf.com/slice-vs-substr-vs-substring-methods-long-string/19
|
|
313
|
+
var i2 = i * 2;
|
|
314
|
+
rgb[i] = parseInt(match.slice(i2, i2 + 2), 16);
|
|
315
|
+
}
|
|
276
316
|
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
317
|
+
if (hexAlpha) {
|
|
318
|
+
rgb[3] = parseInt(hexAlpha, 16) / 255;
|
|
319
|
+
}
|
|
320
|
+
} else if (match = string.match(abbr)) {
|
|
321
|
+
match = match[1];
|
|
322
|
+
hexAlpha = match[3];
|
|
282
323
|
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
} else if (match = string.match(abbr)) {
|
|
287
|
-
match = match[1];
|
|
288
|
-
hexAlpha = match[3];
|
|
324
|
+
for (i = 0; i < 3; i++) {
|
|
325
|
+
rgb[i] = parseInt(match[i] + match[i], 16);
|
|
326
|
+
}
|
|
289
327
|
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
328
|
+
if (hexAlpha) {
|
|
329
|
+
rgb[3] = parseInt(hexAlpha + hexAlpha, 16) / 255;
|
|
330
|
+
}
|
|
331
|
+
} else if (match = string.match(rgba)) {
|
|
332
|
+
for (i = 0; i < 3; i++) {
|
|
333
|
+
rgb[i] = parseInt(match[i + 1], 0);
|
|
334
|
+
}
|
|
293
335
|
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
336
|
+
if (match[4]) {
|
|
337
|
+
if (match[5]) {
|
|
338
|
+
rgb[3] = parseFloat(match[4]) * 0.01;
|
|
339
|
+
} else {
|
|
340
|
+
rgb[3] = parseFloat(match[4]);
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
} else if (match = string.match(per)) {
|
|
344
|
+
for (i = 0; i < 3; i++) {
|
|
345
|
+
rgb[i] = Math.round(parseFloat(match[i + 1]) * 2.55);
|
|
346
|
+
}
|
|
301
347
|
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
348
|
+
if (match[4]) {
|
|
349
|
+
if (match[5]) {
|
|
350
|
+
rgb[3] = parseFloat(match[4]) * 0.01;
|
|
351
|
+
} else {
|
|
352
|
+
rgb[3] = parseFloat(match[4]);
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
} else if (match = string.match(keyword)) {
|
|
356
|
+
if (match[1] === 'transparent') {
|
|
357
|
+
return [0, 0, 0, 0];
|
|
307
358
|
}
|
|
308
|
-
}
|
|
309
|
-
} else if (match = string.match(per)) {
|
|
310
|
-
for (i = 0; i < 3; i++) {
|
|
311
|
-
rgb[i] = Math.round(parseFloat(match[i + 1]) * 2.55);
|
|
312
|
-
}
|
|
313
359
|
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
rgb[3] = parseFloat(match[4]) * 0.01;
|
|
317
|
-
} else {
|
|
318
|
-
rgb[3] = parseFloat(match[4]);
|
|
360
|
+
if (!hasOwnProperty.call(colorNames, match[1])) {
|
|
361
|
+
return null;
|
|
319
362
|
}
|
|
320
|
-
}
|
|
321
|
-
} else if (match = string.match(keyword)) {
|
|
322
|
-
if (match[1] === 'transparent') {
|
|
323
|
-
return [0, 0, 0, 0];
|
|
324
|
-
}
|
|
325
363
|
|
|
326
|
-
|
|
364
|
+
rgb = colorNames[match[1]];
|
|
365
|
+
rgb[3] = 1;
|
|
366
|
+
|
|
367
|
+
return rgb;
|
|
368
|
+
} else {
|
|
327
369
|
return null;
|
|
328
370
|
}
|
|
329
371
|
|
|
330
|
-
|
|
331
|
-
|
|
372
|
+
for (i = 0; i < 3; i++) {
|
|
373
|
+
rgb[i] = clamp(rgb[i], 0, 255);
|
|
374
|
+
}
|
|
375
|
+
rgb[3] = clamp(rgb[3], 0, 1);
|
|
332
376
|
|
|
333
377
|
return rgb;
|
|
334
|
-
}
|
|
335
|
-
return null;
|
|
336
|
-
}
|
|
378
|
+
};
|
|
337
379
|
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
380
|
+
cs.get.hsl = function (string) {
|
|
381
|
+
if (!string) {
|
|
382
|
+
return null;
|
|
383
|
+
}
|
|
342
384
|
|
|
343
|
-
|
|
344
|
-
|
|
385
|
+
var hsl = /^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d\.]+)%\s*,?\s*([+-]?[\d\.]+)%\s*(?:[,|\/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/;
|
|
386
|
+
var match = string.match(hsl);
|
|
345
387
|
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
388
|
+
if (match) {
|
|
389
|
+
var alpha = parseFloat(match[4]);
|
|
390
|
+
var h = ((parseFloat(match[1]) % 360) + 360) % 360;
|
|
391
|
+
var s = clamp(parseFloat(match[2]), 0, 100);
|
|
392
|
+
var l = clamp(parseFloat(match[3]), 0, 100);
|
|
393
|
+
var a = clamp(isNaN(alpha) ? 1 : alpha, 0, 1);
|
|
350
394
|
|
|
351
|
-
|
|
352
|
-
|
|
395
|
+
return [h, s, l, a];
|
|
396
|
+
}
|
|
353
397
|
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
var h = ((parseFloat(match[1]) % 360) + 360) % 360;
|
|
357
|
-
var s = clamp(parseFloat(match[2]), 0, 100);
|
|
358
|
-
var l = clamp(parseFloat(match[3]), 0, 100);
|
|
359
|
-
var a = clamp(isNaN(alpha) ? 1 : alpha, 0, 1);
|
|
398
|
+
return null;
|
|
399
|
+
};
|
|
360
400
|
|
|
361
|
-
|
|
362
|
-
|
|
401
|
+
cs.get.hwb = function (string) {
|
|
402
|
+
if (!string) {
|
|
403
|
+
return null;
|
|
404
|
+
}
|
|
363
405
|
|
|
364
|
-
|
|
365
|
-
|
|
406
|
+
var hwb = /^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/;
|
|
407
|
+
var match = string.match(hwb);
|
|
408
|
+
|
|
409
|
+
if (match) {
|
|
410
|
+
var alpha = parseFloat(match[4]);
|
|
411
|
+
var h = ((parseFloat(match[1]) % 360) + 360) % 360;
|
|
412
|
+
var w = clamp(parseFloat(match[2]), 0, 100);
|
|
413
|
+
var b = clamp(parseFloat(match[3]), 0, 100);
|
|
414
|
+
var a = clamp(isNaN(alpha) ? 1 : alpha, 0, 1);
|
|
415
|
+
return [h, w, b, a];
|
|
416
|
+
}
|
|
366
417
|
|
|
367
|
-
cs.get.hwb = function (string) {
|
|
368
|
-
if (!string) {
|
|
369
418
|
return null;
|
|
370
|
-
}
|
|
419
|
+
};
|
|
371
420
|
|
|
372
|
-
|
|
373
|
-
|
|
421
|
+
cs.to.hex = function () {
|
|
422
|
+
var rgba = swizzle(arguments);
|
|
423
|
+
|
|
424
|
+
return (
|
|
425
|
+
'#' +
|
|
426
|
+
hexDouble(rgba[0]) +
|
|
427
|
+
hexDouble(rgba[1]) +
|
|
428
|
+
hexDouble(rgba[2]) +
|
|
429
|
+
(rgba[3] < 1
|
|
430
|
+
? (hexDouble(Math.round(rgba[3] * 255)))
|
|
431
|
+
: '')
|
|
432
|
+
);
|
|
433
|
+
};
|
|
374
434
|
|
|
375
|
-
|
|
376
|
-
var
|
|
377
|
-
var h = ((parseFloat(match[1]) % 360) + 360) % 360;
|
|
378
|
-
var w = clamp(parseFloat(match[2]), 0, 100);
|
|
379
|
-
var b = clamp(parseFloat(match[3]), 0, 100);
|
|
380
|
-
var a = clamp(isNaN(alpha) ? 1 : alpha, 0, 1);
|
|
381
|
-
return [h, w, b, a];
|
|
382
|
-
}
|
|
435
|
+
cs.to.rgb = function () {
|
|
436
|
+
var rgba = swizzle(arguments);
|
|
383
437
|
|
|
384
|
-
|
|
385
|
-
|
|
438
|
+
return rgba.length < 4 || rgba[3] === 1
|
|
439
|
+
? 'rgb(' + Math.round(rgba[0]) + ', ' + Math.round(rgba[1]) + ', ' + Math.round(rgba[2]) + ')'
|
|
440
|
+
: 'rgba(' + Math.round(rgba[0]) + ', ' + Math.round(rgba[1]) + ', ' + Math.round(rgba[2]) + ', ' + rgba[3] + ')';
|
|
441
|
+
};
|
|
386
442
|
|
|
387
|
-
cs.to.
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
return (
|
|
391
|
-
'#' +
|
|
392
|
-
hexDouble(rgba[0]) +
|
|
393
|
-
hexDouble(rgba[1]) +
|
|
394
|
-
hexDouble(rgba[2]) +
|
|
395
|
-
(rgba[3] < 1
|
|
396
|
-
? (hexDouble(Math.round(rgba[3] * 255)))
|
|
397
|
-
: '')
|
|
398
|
-
);
|
|
399
|
-
};
|
|
443
|
+
cs.to.rgb.percent = function () {
|
|
444
|
+
var rgba = swizzle(arguments);
|
|
400
445
|
|
|
401
|
-
|
|
402
|
-
|
|
446
|
+
var r = Math.round(rgba[0] / 255 * 100);
|
|
447
|
+
var g = Math.round(rgba[1] / 255 * 100);
|
|
448
|
+
var b = Math.round(rgba[2] / 255 * 100);
|
|
403
449
|
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
};
|
|
450
|
+
return rgba.length < 4 || rgba[3] === 1
|
|
451
|
+
? 'rgb(' + r + '%, ' + g + '%, ' + b + '%)'
|
|
452
|
+
: 'rgba(' + r + '%, ' + g + '%, ' + b + '%, ' + rgba[3] + ')';
|
|
453
|
+
};
|
|
408
454
|
|
|
409
|
-
cs.to.
|
|
410
|
-
|
|
455
|
+
cs.to.hsl = function () {
|
|
456
|
+
var hsla = swizzle(arguments);
|
|
457
|
+
return hsla.length < 4 || hsla[3] === 1
|
|
458
|
+
? 'hsl(' + hsla[0] + ', ' + hsla[1] + '%, ' + hsla[2] + '%)'
|
|
459
|
+
: 'hsla(' + hsla[0] + ', ' + hsla[1] + '%, ' + hsla[2] + '%, ' + hsla[3] + ')';
|
|
460
|
+
};
|
|
411
461
|
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
462
|
+
// hwb is a bit different than rgb(a) & hsl(a) since there is no alpha specific syntax
|
|
463
|
+
// (hwb have alpha optional & 1 is default value)
|
|
464
|
+
cs.to.hwb = function () {
|
|
465
|
+
var hwba = swizzle(arguments);
|
|
415
466
|
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
}
|
|
467
|
+
var a = '';
|
|
468
|
+
if (hwba.length >= 4 && hwba[3] !== 1) {
|
|
469
|
+
a = ', ' + hwba[3];
|
|
470
|
+
}
|
|
420
471
|
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
return hsla.length < 4 || hsla[3] === 1
|
|
424
|
-
? 'hsl(' + hsla[0] + ', ' + hsla[1] + '%, ' + hsla[2] + '%)'
|
|
425
|
-
: 'hsla(' + hsla[0] + ', ' + hsla[1] + '%, ' + hsla[2] + '%, ' + hsla[3] + ')';
|
|
426
|
-
};
|
|
472
|
+
return 'hwb(' + hwba[0] + ', ' + hwba[1] + '%, ' + hwba[2] + '%' + a + ')';
|
|
473
|
+
};
|
|
427
474
|
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
var hwba = swizzle(arguments);
|
|
475
|
+
cs.to.keyword = function (rgb) {
|
|
476
|
+
return reverseNames[rgb.slice(0, 3)];
|
|
477
|
+
};
|
|
432
478
|
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
479
|
+
// helpers
|
|
480
|
+
function clamp(num, min, max) {
|
|
481
|
+
return Math.min(Math.max(min, num), max);
|
|
436
482
|
}
|
|
437
483
|
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
return
|
|
443
|
-
};
|
|
444
|
-
|
|
445
|
-
// helpers
|
|
446
|
-
function clamp(num, min, max) {
|
|
447
|
-
return Math.min(Math.max(min, num), max);
|
|
484
|
+
function hexDouble(num) {
|
|
485
|
+
var str = Math.round(num).toString(16).toUpperCase();
|
|
486
|
+
return (str.length < 2) ? '0' + str : str;
|
|
487
|
+
}
|
|
488
|
+
return colorString$1.exports;
|
|
448
489
|
}
|
|
449
490
|
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
491
|
+
var conversions = {exports: {}};
|
|
492
|
+
|
|
493
|
+
var colorName;
|
|
494
|
+
var hasRequiredColorName;
|
|
495
|
+
|
|
496
|
+
function requireColorName () {
|
|
497
|
+
if (hasRequiredColorName) return colorName;
|
|
498
|
+
hasRequiredColorName = 1;
|
|
499
|
+
|
|
500
|
+
colorName = {
|
|
501
|
+
"aliceblue": [240, 248, 255],
|
|
502
|
+
"antiquewhite": [250, 235, 215],
|
|
503
|
+
"aqua": [0, 255, 255],
|
|
504
|
+
"aquamarine": [127, 255, 212],
|
|
505
|
+
"azure": [240, 255, 255],
|
|
506
|
+
"beige": [245, 245, 220],
|
|
507
|
+
"bisque": [255, 228, 196],
|
|
508
|
+
"black": [0, 0, 0],
|
|
509
|
+
"blanchedalmond": [255, 235, 205],
|
|
510
|
+
"blue": [0, 0, 255],
|
|
511
|
+
"blueviolet": [138, 43, 226],
|
|
512
|
+
"brown": [165, 42, 42],
|
|
513
|
+
"burlywood": [222, 184, 135],
|
|
514
|
+
"cadetblue": [95, 158, 160],
|
|
515
|
+
"chartreuse": [127, 255, 0],
|
|
516
|
+
"chocolate": [210, 105, 30],
|
|
517
|
+
"coral": [255, 127, 80],
|
|
518
|
+
"cornflowerblue": [100, 149, 237],
|
|
519
|
+
"cornsilk": [255, 248, 220],
|
|
520
|
+
"crimson": [220, 20, 60],
|
|
521
|
+
"cyan": [0, 255, 255],
|
|
522
|
+
"darkblue": [0, 0, 139],
|
|
523
|
+
"darkcyan": [0, 139, 139],
|
|
524
|
+
"darkgoldenrod": [184, 134, 11],
|
|
525
|
+
"darkgray": [169, 169, 169],
|
|
526
|
+
"darkgreen": [0, 100, 0],
|
|
527
|
+
"darkgrey": [169, 169, 169],
|
|
528
|
+
"darkkhaki": [189, 183, 107],
|
|
529
|
+
"darkmagenta": [139, 0, 139],
|
|
530
|
+
"darkolivegreen": [85, 107, 47],
|
|
531
|
+
"darkorange": [255, 140, 0],
|
|
532
|
+
"darkorchid": [153, 50, 204],
|
|
533
|
+
"darkred": [139, 0, 0],
|
|
534
|
+
"darksalmon": [233, 150, 122],
|
|
535
|
+
"darkseagreen": [143, 188, 143],
|
|
536
|
+
"darkslateblue": [72, 61, 139],
|
|
537
|
+
"darkslategray": [47, 79, 79],
|
|
538
|
+
"darkslategrey": [47, 79, 79],
|
|
539
|
+
"darkturquoise": [0, 206, 209],
|
|
540
|
+
"darkviolet": [148, 0, 211],
|
|
541
|
+
"deeppink": [255, 20, 147],
|
|
542
|
+
"deepskyblue": [0, 191, 255],
|
|
543
|
+
"dimgray": [105, 105, 105],
|
|
544
|
+
"dimgrey": [105, 105, 105],
|
|
545
|
+
"dodgerblue": [30, 144, 255],
|
|
546
|
+
"firebrick": [178, 34, 34],
|
|
547
|
+
"floralwhite": [255, 250, 240],
|
|
548
|
+
"forestgreen": [34, 139, 34],
|
|
549
|
+
"fuchsia": [255, 0, 255],
|
|
550
|
+
"gainsboro": [220, 220, 220],
|
|
551
|
+
"ghostwhite": [248, 248, 255],
|
|
552
|
+
"gold": [255, 215, 0],
|
|
553
|
+
"goldenrod": [218, 165, 32],
|
|
554
|
+
"gray": [128, 128, 128],
|
|
555
|
+
"green": [0, 128, 0],
|
|
556
|
+
"greenyellow": [173, 255, 47],
|
|
557
|
+
"grey": [128, 128, 128],
|
|
558
|
+
"honeydew": [240, 255, 240],
|
|
559
|
+
"hotpink": [255, 105, 180],
|
|
560
|
+
"indianred": [205, 92, 92],
|
|
561
|
+
"indigo": [75, 0, 130],
|
|
562
|
+
"ivory": [255, 255, 240],
|
|
563
|
+
"khaki": [240, 230, 140],
|
|
564
|
+
"lavender": [230, 230, 250],
|
|
565
|
+
"lavenderblush": [255, 240, 245],
|
|
566
|
+
"lawngreen": [124, 252, 0],
|
|
567
|
+
"lemonchiffon": [255, 250, 205],
|
|
568
|
+
"lightblue": [173, 216, 230],
|
|
569
|
+
"lightcoral": [240, 128, 128],
|
|
570
|
+
"lightcyan": [224, 255, 255],
|
|
571
|
+
"lightgoldenrodyellow": [250, 250, 210],
|
|
572
|
+
"lightgray": [211, 211, 211],
|
|
573
|
+
"lightgreen": [144, 238, 144],
|
|
574
|
+
"lightgrey": [211, 211, 211],
|
|
575
|
+
"lightpink": [255, 182, 193],
|
|
576
|
+
"lightsalmon": [255, 160, 122],
|
|
577
|
+
"lightseagreen": [32, 178, 170],
|
|
578
|
+
"lightskyblue": [135, 206, 250],
|
|
579
|
+
"lightslategray": [119, 136, 153],
|
|
580
|
+
"lightslategrey": [119, 136, 153],
|
|
581
|
+
"lightsteelblue": [176, 196, 222],
|
|
582
|
+
"lightyellow": [255, 255, 224],
|
|
583
|
+
"lime": [0, 255, 0],
|
|
584
|
+
"limegreen": [50, 205, 50],
|
|
585
|
+
"linen": [250, 240, 230],
|
|
586
|
+
"magenta": [255, 0, 255],
|
|
587
|
+
"maroon": [128, 0, 0],
|
|
588
|
+
"mediumaquamarine": [102, 205, 170],
|
|
589
|
+
"mediumblue": [0, 0, 205],
|
|
590
|
+
"mediumorchid": [186, 85, 211],
|
|
591
|
+
"mediumpurple": [147, 112, 219],
|
|
592
|
+
"mediumseagreen": [60, 179, 113],
|
|
593
|
+
"mediumslateblue": [123, 104, 238],
|
|
594
|
+
"mediumspringgreen": [0, 250, 154],
|
|
595
|
+
"mediumturquoise": [72, 209, 204],
|
|
596
|
+
"mediumvioletred": [199, 21, 133],
|
|
597
|
+
"midnightblue": [25, 25, 112],
|
|
598
|
+
"mintcream": [245, 255, 250],
|
|
599
|
+
"mistyrose": [255, 228, 225],
|
|
600
|
+
"moccasin": [255, 228, 181],
|
|
601
|
+
"navajowhite": [255, 222, 173],
|
|
602
|
+
"navy": [0, 0, 128],
|
|
603
|
+
"oldlace": [253, 245, 230],
|
|
604
|
+
"olive": [128, 128, 0],
|
|
605
|
+
"olivedrab": [107, 142, 35],
|
|
606
|
+
"orange": [255, 165, 0],
|
|
607
|
+
"orangered": [255, 69, 0],
|
|
608
|
+
"orchid": [218, 112, 214],
|
|
609
|
+
"palegoldenrod": [238, 232, 170],
|
|
610
|
+
"palegreen": [152, 251, 152],
|
|
611
|
+
"paleturquoise": [175, 238, 238],
|
|
612
|
+
"palevioletred": [219, 112, 147],
|
|
613
|
+
"papayawhip": [255, 239, 213],
|
|
614
|
+
"peachpuff": [255, 218, 185],
|
|
615
|
+
"peru": [205, 133, 63],
|
|
616
|
+
"pink": [255, 192, 203],
|
|
617
|
+
"plum": [221, 160, 221],
|
|
618
|
+
"powderblue": [176, 224, 230],
|
|
619
|
+
"purple": [128, 0, 128],
|
|
620
|
+
"rebeccapurple": [102, 51, 153],
|
|
621
|
+
"red": [255, 0, 0],
|
|
622
|
+
"rosybrown": [188, 143, 143],
|
|
623
|
+
"royalblue": [65, 105, 225],
|
|
624
|
+
"saddlebrown": [139, 69, 19],
|
|
625
|
+
"salmon": [250, 128, 114],
|
|
626
|
+
"sandybrown": [244, 164, 96],
|
|
627
|
+
"seagreen": [46, 139, 87],
|
|
628
|
+
"seashell": [255, 245, 238],
|
|
629
|
+
"sienna": [160, 82, 45],
|
|
630
|
+
"silver": [192, 192, 192],
|
|
631
|
+
"skyblue": [135, 206, 235],
|
|
632
|
+
"slateblue": [106, 90, 205],
|
|
633
|
+
"slategray": [112, 128, 144],
|
|
634
|
+
"slategrey": [112, 128, 144],
|
|
635
|
+
"snow": [255, 250, 250],
|
|
636
|
+
"springgreen": [0, 255, 127],
|
|
637
|
+
"steelblue": [70, 130, 180],
|
|
638
|
+
"tan": [210, 180, 140],
|
|
639
|
+
"teal": [0, 128, 128],
|
|
640
|
+
"thistle": [216, 191, 216],
|
|
641
|
+
"tomato": [255, 99, 71],
|
|
642
|
+
"turquoise": [64, 224, 208],
|
|
643
|
+
"violet": [238, 130, 238],
|
|
644
|
+
"wheat": [245, 222, 179],
|
|
645
|
+
"white": [255, 255, 255],
|
|
646
|
+
"whitesmoke": [245, 245, 245],
|
|
647
|
+
"yellow": [255, 255, 0],
|
|
648
|
+
"yellowgreen": [154, 205, 50]
|
|
649
|
+
};
|
|
650
|
+
return colorName;
|
|
453
651
|
}
|
|
454
652
|
|
|
455
|
-
const colorString$1 = colorString$2.exports;
|
|
456
|
-
|
|
457
|
-
var conversions$2 = {exports: {}};
|
|
458
|
-
|
|
459
|
-
var colorName = {
|
|
460
|
-
"aliceblue": [240, 248, 255],
|
|
461
|
-
"antiquewhite": [250, 235, 215],
|
|
462
|
-
"aqua": [0, 255, 255],
|
|
463
|
-
"aquamarine": [127, 255, 212],
|
|
464
|
-
"azure": [240, 255, 255],
|
|
465
|
-
"beige": [245, 245, 220],
|
|
466
|
-
"bisque": [255, 228, 196],
|
|
467
|
-
"black": [0, 0, 0],
|
|
468
|
-
"blanchedalmond": [255, 235, 205],
|
|
469
|
-
"blue": [0, 0, 255],
|
|
470
|
-
"blueviolet": [138, 43, 226],
|
|
471
|
-
"brown": [165, 42, 42],
|
|
472
|
-
"burlywood": [222, 184, 135],
|
|
473
|
-
"cadetblue": [95, 158, 160],
|
|
474
|
-
"chartreuse": [127, 255, 0],
|
|
475
|
-
"chocolate": [210, 105, 30],
|
|
476
|
-
"coral": [255, 127, 80],
|
|
477
|
-
"cornflowerblue": [100, 149, 237],
|
|
478
|
-
"cornsilk": [255, 248, 220],
|
|
479
|
-
"crimson": [220, 20, 60],
|
|
480
|
-
"cyan": [0, 255, 255],
|
|
481
|
-
"darkblue": [0, 0, 139],
|
|
482
|
-
"darkcyan": [0, 139, 139],
|
|
483
|
-
"darkgoldenrod": [184, 134, 11],
|
|
484
|
-
"darkgray": [169, 169, 169],
|
|
485
|
-
"darkgreen": [0, 100, 0],
|
|
486
|
-
"darkgrey": [169, 169, 169],
|
|
487
|
-
"darkkhaki": [189, 183, 107],
|
|
488
|
-
"darkmagenta": [139, 0, 139],
|
|
489
|
-
"darkolivegreen": [85, 107, 47],
|
|
490
|
-
"darkorange": [255, 140, 0],
|
|
491
|
-
"darkorchid": [153, 50, 204],
|
|
492
|
-
"darkred": [139, 0, 0],
|
|
493
|
-
"darksalmon": [233, 150, 122],
|
|
494
|
-
"darkseagreen": [143, 188, 143],
|
|
495
|
-
"darkslateblue": [72, 61, 139],
|
|
496
|
-
"darkslategray": [47, 79, 79],
|
|
497
|
-
"darkslategrey": [47, 79, 79],
|
|
498
|
-
"darkturquoise": [0, 206, 209],
|
|
499
|
-
"darkviolet": [148, 0, 211],
|
|
500
|
-
"deeppink": [255, 20, 147],
|
|
501
|
-
"deepskyblue": [0, 191, 255],
|
|
502
|
-
"dimgray": [105, 105, 105],
|
|
503
|
-
"dimgrey": [105, 105, 105],
|
|
504
|
-
"dodgerblue": [30, 144, 255],
|
|
505
|
-
"firebrick": [178, 34, 34],
|
|
506
|
-
"floralwhite": [255, 250, 240],
|
|
507
|
-
"forestgreen": [34, 139, 34],
|
|
508
|
-
"fuchsia": [255, 0, 255],
|
|
509
|
-
"gainsboro": [220, 220, 220],
|
|
510
|
-
"ghostwhite": [248, 248, 255],
|
|
511
|
-
"gold": [255, 215, 0],
|
|
512
|
-
"goldenrod": [218, 165, 32],
|
|
513
|
-
"gray": [128, 128, 128],
|
|
514
|
-
"green": [0, 128, 0],
|
|
515
|
-
"greenyellow": [173, 255, 47],
|
|
516
|
-
"grey": [128, 128, 128],
|
|
517
|
-
"honeydew": [240, 255, 240],
|
|
518
|
-
"hotpink": [255, 105, 180],
|
|
519
|
-
"indianred": [205, 92, 92],
|
|
520
|
-
"indigo": [75, 0, 130],
|
|
521
|
-
"ivory": [255, 255, 240],
|
|
522
|
-
"khaki": [240, 230, 140],
|
|
523
|
-
"lavender": [230, 230, 250],
|
|
524
|
-
"lavenderblush": [255, 240, 245],
|
|
525
|
-
"lawngreen": [124, 252, 0],
|
|
526
|
-
"lemonchiffon": [255, 250, 205],
|
|
527
|
-
"lightblue": [173, 216, 230],
|
|
528
|
-
"lightcoral": [240, 128, 128],
|
|
529
|
-
"lightcyan": [224, 255, 255],
|
|
530
|
-
"lightgoldenrodyellow": [250, 250, 210],
|
|
531
|
-
"lightgray": [211, 211, 211],
|
|
532
|
-
"lightgreen": [144, 238, 144],
|
|
533
|
-
"lightgrey": [211, 211, 211],
|
|
534
|
-
"lightpink": [255, 182, 193],
|
|
535
|
-
"lightsalmon": [255, 160, 122],
|
|
536
|
-
"lightseagreen": [32, 178, 170],
|
|
537
|
-
"lightskyblue": [135, 206, 250],
|
|
538
|
-
"lightslategray": [119, 136, 153],
|
|
539
|
-
"lightslategrey": [119, 136, 153],
|
|
540
|
-
"lightsteelblue": [176, 196, 222],
|
|
541
|
-
"lightyellow": [255, 255, 224],
|
|
542
|
-
"lime": [0, 255, 0],
|
|
543
|
-
"limegreen": [50, 205, 50],
|
|
544
|
-
"linen": [250, 240, 230],
|
|
545
|
-
"magenta": [255, 0, 255],
|
|
546
|
-
"maroon": [128, 0, 0],
|
|
547
|
-
"mediumaquamarine": [102, 205, 170],
|
|
548
|
-
"mediumblue": [0, 0, 205],
|
|
549
|
-
"mediumorchid": [186, 85, 211],
|
|
550
|
-
"mediumpurple": [147, 112, 219],
|
|
551
|
-
"mediumseagreen": [60, 179, 113],
|
|
552
|
-
"mediumslateblue": [123, 104, 238],
|
|
553
|
-
"mediumspringgreen": [0, 250, 154],
|
|
554
|
-
"mediumturquoise": [72, 209, 204],
|
|
555
|
-
"mediumvioletred": [199, 21, 133],
|
|
556
|
-
"midnightblue": [25, 25, 112],
|
|
557
|
-
"mintcream": [245, 255, 250],
|
|
558
|
-
"mistyrose": [255, 228, 225],
|
|
559
|
-
"moccasin": [255, 228, 181],
|
|
560
|
-
"navajowhite": [255, 222, 173],
|
|
561
|
-
"navy": [0, 0, 128],
|
|
562
|
-
"oldlace": [253, 245, 230],
|
|
563
|
-
"olive": [128, 128, 0],
|
|
564
|
-
"olivedrab": [107, 142, 35],
|
|
565
|
-
"orange": [255, 165, 0],
|
|
566
|
-
"orangered": [255, 69, 0],
|
|
567
|
-
"orchid": [218, 112, 214],
|
|
568
|
-
"palegoldenrod": [238, 232, 170],
|
|
569
|
-
"palegreen": [152, 251, 152],
|
|
570
|
-
"paleturquoise": [175, 238, 238],
|
|
571
|
-
"palevioletred": [219, 112, 147],
|
|
572
|
-
"papayawhip": [255, 239, 213],
|
|
573
|
-
"peachpuff": [255, 218, 185],
|
|
574
|
-
"peru": [205, 133, 63],
|
|
575
|
-
"pink": [255, 192, 203],
|
|
576
|
-
"plum": [221, 160, 221],
|
|
577
|
-
"powderblue": [176, 224, 230],
|
|
578
|
-
"purple": [128, 0, 128],
|
|
579
|
-
"rebeccapurple": [102, 51, 153],
|
|
580
|
-
"red": [255, 0, 0],
|
|
581
|
-
"rosybrown": [188, 143, 143],
|
|
582
|
-
"royalblue": [65, 105, 225],
|
|
583
|
-
"saddlebrown": [139, 69, 19],
|
|
584
|
-
"salmon": [250, 128, 114],
|
|
585
|
-
"sandybrown": [244, 164, 96],
|
|
586
|
-
"seagreen": [46, 139, 87],
|
|
587
|
-
"seashell": [255, 245, 238],
|
|
588
|
-
"sienna": [160, 82, 45],
|
|
589
|
-
"silver": [192, 192, 192],
|
|
590
|
-
"skyblue": [135, 206, 235],
|
|
591
|
-
"slateblue": [106, 90, 205],
|
|
592
|
-
"slategray": [112, 128, 144],
|
|
593
|
-
"slategrey": [112, 128, 144],
|
|
594
|
-
"snow": [255, 250, 250],
|
|
595
|
-
"springgreen": [0, 255, 127],
|
|
596
|
-
"steelblue": [70, 130, 180],
|
|
597
|
-
"tan": [210, 180, 140],
|
|
598
|
-
"teal": [0, 128, 128],
|
|
599
|
-
"thistle": [216, 191, 216],
|
|
600
|
-
"tomato": [255, 99, 71],
|
|
601
|
-
"turquoise": [64, 224, 208],
|
|
602
|
-
"violet": [238, 130, 238],
|
|
603
|
-
"wheat": [245, 222, 179],
|
|
604
|
-
"white": [255, 255, 255],
|
|
605
|
-
"whitesmoke": [245, 245, 245],
|
|
606
|
-
"yellow": [255, 255, 0],
|
|
607
|
-
"yellowgreen": [154, 205, 50]
|
|
608
|
-
};
|
|
609
|
-
|
|
610
653
|
/* MIT license */
|
|
611
654
|
|
|
612
|
-
var
|
|
655
|
+
var hasRequiredConversions;
|
|
613
656
|
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
657
|
+
function requireConversions () {
|
|
658
|
+
if (hasRequiredConversions) return conversions.exports;
|
|
659
|
+
hasRequiredConversions = 1;
|
|
660
|
+
var cssKeywords = requireColorName();
|
|
617
661
|
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
reverseKeywords[cssKeywords[key]] = key;
|
|
622
|
-
}
|
|
623
|
-
}
|
|
662
|
+
// NOTE: conversions should only return primitive values (i.e. arrays, or
|
|
663
|
+
// values that give correct `typeof` results).
|
|
664
|
+
// do not use box values types (i.e. Number(), String(), etc.)
|
|
624
665
|
|
|
625
|
-
var
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
hwb: {channels: 3, labels: 'hwb'},
|
|
630
|
-
cmyk: {channels: 4, labels: 'cmyk'},
|
|
631
|
-
xyz: {channels: 3, labels: 'xyz'},
|
|
632
|
-
lab: {channels: 3, labels: 'lab'},
|
|
633
|
-
lch: {channels: 3, labels: 'lch'},
|
|
634
|
-
hex: {channels: 1, labels: ['hex']},
|
|
635
|
-
keyword: {channels: 1, labels: ['keyword']},
|
|
636
|
-
ansi16: {channels: 1, labels: ['ansi16']},
|
|
637
|
-
ansi256: {channels: 1, labels: ['ansi256']},
|
|
638
|
-
hcg: {channels: 3, labels: ['h', 'c', 'g']},
|
|
639
|
-
apple: {channels: 3, labels: ['r16', 'g16', 'b16']},
|
|
640
|
-
gray: {channels: 1, labels: ['gray']}
|
|
641
|
-
};
|
|
642
|
-
|
|
643
|
-
// hide .channels and .labels properties
|
|
644
|
-
for (var model in convert$2) {
|
|
645
|
-
if (convert$2.hasOwnProperty(model)) {
|
|
646
|
-
if (!('channels' in convert$2[model])) {
|
|
647
|
-
throw new Error('missing channels property: ' + model);
|
|
648
|
-
}
|
|
649
|
-
|
|
650
|
-
if (!('labels' in convert$2[model])) {
|
|
651
|
-
throw new Error('missing channel labels property: ' + model);
|
|
666
|
+
var reverseKeywords = {};
|
|
667
|
+
for (var key in cssKeywords) {
|
|
668
|
+
if (cssKeywords.hasOwnProperty(key)) {
|
|
669
|
+
reverseKeywords[cssKeywords[key]] = key;
|
|
652
670
|
}
|
|
653
|
-
|
|
654
|
-
if (convert$2[model].labels.length !== convert$2[model].channels) {
|
|
655
|
-
throw new Error('channel and label counts mismatch: ' + model);
|
|
656
|
-
}
|
|
657
|
-
|
|
658
|
-
var channels = convert$2[model].channels;
|
|
659
|
-
var labels = convert$2[model].labels;
|
|
660
|
-
delete convert$2[model].channels;
|
|
661
|
-
delete convert$2[model].labels;
|
|
662
|
-
Object.defineProperty(convert$2[model], 'channels', {value: channels});
|
|
663
|
-
Object.defineProperty(convert$2[model], 'labels', {value: labels});
|
|
664
671
|
}
|
|
665
|
-
}
|
|
666
672
|
|
|
667
|
-
convert
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
} else if (b === max) {
|
|
685
|
-
h = 4 + (r - g) / delta;
|
|
686
|
-
}
|
|
673
|
+
var convert = conversions.exports = {
|
|
674
|
+
rgb: {channels: 3, labels: 'rgb'},
|
|
675
|
+
hsl: {channels: 3, labels: 'hsl'},
|
|
676
|
+
hsv: {channels: 3, labels: 'hsv'},
|
|
677
|
+
hwb: {channels: 3, labels: 'hwb'},
|
|
678
|
+
cmyk: {channels: 4, labels: 'cmyk'},
|
|
679
|
+
xyz: {channels: 3, labels: 'xyz'},
|
|
680
|
+
lab: {channels: 3, labels: 'lab'},
|
|
681
|
+
lch: {channels: 3, labels: 'lch'},
|
|
682
|
+
hex: {channels: 1, labels: ['hex']},
|
|
683
|
+
keyword: {channels: 1, labels: ['keyword']},
|
|
684
|
+
ansi16: {channels: 1, labels: ['ansi16']},
|
|
685
|
+
ansi256: {channels: 1, labels: ['ansi256']},
|
|
686
|
+
hcg: {channels: 3, labels: ['h', 'c', 'g']},
|
|
687
|
+
apple: {channels: 3, labels: ['r16', 'g16', 'b16']},
|
|
688
|
+
gray: {channels: 1, labels: ['gray']}
|
|
689
|
+
};
|
|
687
690
|
|
|
688
|
-
|
|
691
|
+
// hide .channels and .labels properties
|
|
692
|
+
for (var model in convert) {
|
|
693
|
+
if (convert.hasOwnProperty(model)) {
|
|
694
|
+
if (!('channels' in convert[model])) {
|
|
695
|
+
throw new Error('missing channels property: ' + model);
|
|
696
|
+
}
|
|
689
697
|
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
698
|
+
if (!('labels' in convert[model])) {
|
|
699
|
+
throw new Error('missing channel labels property: ' + model);
|
|
700
|
+
}
|
|
693
701
|
|
|
694
|
-
|
|
702
|
+
if (convert[model].labels.length !== convert[model].channels) {
|
|
703
|
+
throw new Error('channel and label counts mismatch: ' + model);
|
|
704
|
+
}
|
|
695
705
|
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
706
|
+
var channels = convert[model].channels;
|
|
707
|
+
var labels = convert[model].labels;
|
|
708
|
+
delete convert[model].channels;
|
|
709
|
+
delete convert[model].labels;
|
|
710
|
+
Object.defineProperty(convert[model], 'channels', {value: channels});
|
|
711
|
+
Object.defineProperty(convert[model], 'labels', {value: labels});
|
|
712
|
+
}
|
|
702
713
|
}
|
|
703
714
|
|
|
704
|
-
|
|
705
|
-
|
|
715
|
+
convert.rgb.hsl = function (rgb) {
|
|
716
|
+
var r = rgb[0] / 255;
|
|
717
|
+
var g = rgb[1] / 255;
|
|
718
|
+
var b = rgb[2] / 255;
|
|
719
|
+
var min = Math.min(r, g, b);
|
|
720
|
+
var max = Math.max(r, g, b);
|
|
721
|
+
var delta = max - min;
|
|
722
|
+
var h;
|
|
723
|
+
var s;
|
|
724
|
+
var l;
|
|
725
|
+
|
|
726
|
+
if (max === min) {
|
|
727
|
+
h = 0;
|
|
728
|
+
} else if (r === max) {
|
|
729
|
+
h = (g - b) / delta;
|
|
730
|
+
} else if (g === max) {
|
|
731
|
+
h = 2 + (b - r) / delta;
|
|
732
|
+
} else if (b === max) {
|
|
733
|
+
h = 4 + (r - g) / delta;
|
|
734
|
+
}
|
|
706
735
|
|
|
707
|
-
|
|
708
|
-
var rdif;
|
|
709
|
-
var gdif;
|
|
710
|
-
var bdif;
|
|
711
|
-
var h;
|
|
712
|
-
var s;
|
|
713
|
-
|
|
714
|
-
var r = rgb[0] / 255;
|
|
715
|
-
var g = rgb[1] / 255;
|
|
716
|
-
var b = rgb[2] / 255;
|
|
717
|
-
var v = Math.max(r, g, b);
|
|
718
|
-
var diff = v - Math.min(r, g, b);
|
|
719
|
-
var diffc = function (c) {
|
|
720
|
-
return (v - c) / 6 / diff + 1 / 2;
|
|
721
|
-
};
|
|
736
|
+
h = Math.min(h * 60, 360);
|
|
722
737
|
|
|
723
|
-
if (diff === 0) {
|
|
724
|
-
h = s = 0;
|
|
725
|
-
} else {
|
|
726
|
-
s = diff / v;
|
|
727
|
-
rdif = diffc(r);
|
|
728
|
-
gdif = diffc(g);
|
|
729
|
-
bdif = diffc(b);
|
|
730
|
-
|
|
731
|
-
if (r === v) {
|
|
732
|
-
h = bdif - gdif;
|
|
733
|
-
} else if (g === v) {
|
|
734
|
-
h = (1 / 3) + rdif - bdif;
|
|
735
|
-
} else if (b === v) {
|
|
736
|
-
h = (2 / 3) + gdif - rdif;
|
|
737
|
-
}
|
|
738
738
|
if (h < 0) {
|
|
739
|
-
h +=
|
|
740
|
-
} else if (h > 1) {
|
|
741
|
-
h -= 1;
|
|
739
|
+
h += 360;
|
|
742
740
|
}
|
|
743
|
-
}
|
|
744
741
|
|
|
745
|
-
|
|
746
|
-
h * 360,
|
|
747
|
-
s * 100,
|
|
748
|
-
v * 100
|
|
749
|
-
];
|
|
750
|
-
};
|
|
742
|
+
l = (min + max) / 2;
|
|
751
743
|
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
744
|
+
if (max === min) {
|
|
745
|
+
s = 0;
|
|
746
|
+
} else if (l <= 0.5) {
|
|
747
|
+
s = delta / (max + min);
|
|
748
|
+
} else {
|
|
749
|
+
s = delta / (2 - max - min);
|
|
750
|
+
}
|
|
758
751
|
|
|
759
|
-
|
|
752
|
+
return [h, s * 100, l * 100];
|
|
753
|
+
};
|
|
760
754
|
|
|
761
|
-
|
|
762
|
-
|
|
755
|
+
convert.rgb.hsv = function (rgb) {
|
|
756
|
+
var rdif;
|
|
757
|
+
var gdif;
|
|
758
|
+
var bdif;
|
|
759
|
+
var h;
|
|
760
|
+
var s;
|
|
761
|
+
|
|
762
|
+
var r = rgb[0] / 255;
|
|
763
|
+
var g = rgb[1] / 255;
|
|
764
|
+
var b = rgb[2] / 255;
|
|
765
|
+
var v = Math.max(r, g, b);
|
|
766
|
+
var diff = v - Math.min(r, g, b);
|
|
767
|
+
var diffc = function (c) {
|
|
768
|
+
return (v - c) / 6 / diff + 1 / 2;
|
|
769
|
+
};
|
|
763
770
|
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
771
|
+
if (diff === 0) {
|
|
772
|
+
h = s = 0;
|
|
773
|
+
} else {
|
|
774
|
+
s = diff / v;
|
|
775
|
+
rdif = diffc(r);
|
|
776
|
+
gdif = diffc(g);
|
|
777
|
+
bdif = diffc(b);
|
|
778
|
+
|
|
779
|
+
if (r === v) {
|
|
780
|
+
h = bdif - gdif;
|
|
781
|
+
} else if (g === v) {
|
|
782
|
+
h = (1 / 3) + rdif - bdif;
|
|
783
|
+
} else if (b === v) {
|
|
784
|
+
h = (2 / 3) + gdif - rdif;
|
|
785
|
+
}
|
|
786
|
+
if (h < 0) {
|
|
787
|
+
h += 1;
|
|
788
|
+
} else if (h > 1) {
|
|
789
|
+
h -= 1;
|
|
790
|
+
}
|
|
791
|
+
}
|
|
780
792
|
|
|
781
|
-
|
|
782
|
-
*
|
|
783
|
-
*
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
Math.pow(x[1] - y[1], 2) +
|
|
788
|
-
Math.pow(x[2] - y[2], 2)
|
|
789
|
-
);
|
|
790
|
-
}
|
|
793
|
+
return [
|
|
794
|
+
h * 360,
|
|
795
|
+
s * 100,
|
|
796
|
+
v * 100
|
|
797
|
+
];
|
|
798
|
+
};
|
|
791
799
|
|
|
792
|
-
convert
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
800
|
+
convert.rgb.hwb = function (rgb) {
|
|
801
|
+
var r = rgb[0];
|
|
802
|
+
var g = rgb[1];
|
|
803
|
+
var b = rgb[2];
|
|
804
|
+
var h = convert.rgb.hsl(rgb)[0];
|
|
805
|
+
var w = 1 / 255 * Math.min(r, Math.min(g, b));
|
|
797
806
|
|
|
798
|
-
|
|
799
|
-
var currentClosestKeyword;
|
|
807
|
+
b = 1 - 1 / 255 * Math.max(r, Math.max(g, b));
|
|
800
808
|
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
var value = cssKeywords[keyword];
|
|
809
|
+
return [h, w * 100, b * 100];
|
|
810
|
+
};
|
|
804
811
|
|
|
805
|
-
|
|
806
|
-
|
|
812
|
+
convert.rgb.cmyk = function (rgb) {
|
|
813
|
+
var r = rgb[0] / 255;
|
|
814
|
+
var g = rgb[1] / 255;
|
|
815
|
+
var b = rgb[2] / 255;
|
|
816
|
+
var c;
|
|
817
|
+
var m;
|
|
818
|
+
var y;
|
|
819
|
+
var k;
|
|
820
|
+
|
|
821
|
+
k = Math.min(1 - r, 1 - g, 1 - b);
|
|
822
|
+
c = (1 - r - k) / (1 - k) || 0;
|
|
823
|
+
m = (1 - g - k) / (1 - k) || 0;
|
|
824
|
+
y = (1 - b - k) / (1 - k) || 0;
|
|
825
|
+
|
|
826
|
+
return [c * 100, m * 100, y * 100, k * 100];
|
|
827
|
+
};
|
|
807
828
|
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
829
|
+
/**
|
|
830
|
+
* See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
|
831
|
+
* */
|
|
832
|
+
function comparativeDistance(x, y) {
|
|
833
|
+
return (
|
|
834
|
+
Math.pow(x[0] - y[0], 2) +
|
|
835
|
+
Math.pow(x[1] - y[1], 2) +
|
|
836
|
+
Math.pow(x[2] - y[2], 2)
|
|
837
|
+
);
|
|
814
838
|
}
|
|
815
839
|
|
|
816
|
-
|
|
817
|
-
|
|
840
|
+
convert.rgb.keyword = function (rgb) {
|
|
841
|
+
var reversed = reverseKeywords[rgb];
|
|
842
|
+
if (reversed) {
|
|
843
|
+
return reversed;
|
|
844
|
+
}
|
|
818
845
|
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
};
|
|
846
|
+
var currentClosestDistance = Infinity;
|
|
847
|
+
var currentClosestKeyword;
|
|
822
848
|
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
var b = rgb[2] / 255;
|
|
849
|
+
for (var keyword in cssKeywords) {
|
|
850
|
+
if (cssKeywords.hasOwnProperty(keyword)) {
|
|
851
|
+
var value = cssKeywords[keyword];
|
|
827
852
|
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
g = g > 0.04045 ? Math.pow(((g + 0.055) / 1.055), 2.4) : (g / 12.92);
|
|
831
|
-
b = b > 0.04045 ? Math.pow(((b + 0.055) / 1.055), 2.4) : (b / 12.92);
|
|
853
|
+
// Compute comparative distance
|
|
854
|
+
var distance = comparativeDistance(rgb, value);
|
|
832
855
|
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
856
|
+
// Check if its less, if so set as closest
|
|
857
|
+
if (distance < currentClosestDistance) {
|
|
858
|
+
currentClosestDistance = distance;
|
|
859
|
+
currentClosestKeyword = keyword;
|
|
860
|
+
}
|
|
861
|
+
}
|
|
862
|
+
}
|
|
836
863
|
|
|
837
|
-
|
|
838
|
-
};
|
|
864
|
+
return currentClosestKeyword;
|
|
865
|
+
};
|
|
839
866
|
|
|
840
|
-
convert
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
var y = xyz[1];
|
|
844
|
-
var z = xyz[2];
|
|
845
|
-
var l;
|
|
846
|
-
var a;
|
|
847
|
-
var b;
|
|
867
|
+
convert.keyword.rgb = function (keyword) {
|
|
868
|
+
return cssKeywords[keyword];
|
|
869
|
+
};
|
|
848
870
|
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
871
|
+
convert.rgb.xyz = function (rgb) {
|
|
872
|
+
var r = rgb[0] / 255;
|
|
873
|
+
var g = rgb[1] / 255;
|
|
874
|
+
var b = rgb[2] / 255;
|
|
852
875
|
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
876
|
+
// assume sRGB
|
|
877
|
+
r = r > 0.04045 ? Math.pow(((r + 0.055) / 1.055), 2.4) : (r / 12.92);
|
|
878
|
+
g = g > 0.04045 ? Math.pow(((g + 0.055) / 1.055), 2.4) : (g / 12.92);
|
|
879
|
+
b = b > 0.04045 ? Math.pow(((b + 0.055) / 1.055), 2.4) : (b / 12.92);
|
|
856
880
|
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
881
|
+
var x = (r * 0.4124) + (g * 0.3576) + (b * 0.1805);
|
|
882
|
+
var y = (r * 0.2126) + (g * 0.7152) + (b * 0.0722);
|
|
883
|
+
var z = (r * 0.0193) + (g * 0.1192) + (b * 0.9505);
|
|
860
884
|
|
|
861
|
-
|
|
862
|
-
};
|
|
885
|
+
return [x * 100, y * 100, z * 100];
|
|
886
|
+
};
|
|
863
887
|
|
|
864
|
-
convert
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
var val;
|
|
873
|
-
|
|
874
|
-
if (s === 0) {
|
|
875
|
-
val = l * 255;
|
|
876
|
-
return [val, val, val];
|
|
877
|
-
}
|
|
888
|
+
convert.rgb.lab = function (rgb) {
|
|
889
|
+
var xyz = convert.rgb.xyz(rgb);
|
|
890
|
+
var x = xyz[0];
|
|
891
|
+
var y = xyz[1];
|
|
892
|
+
var z = xyz[2];
|
|
893
|
+
var l;
|
|
894
|
+
var a;
|
|
895
|
+
var b;
|
|
878
896
|
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
t2 = l + s - l * s;
|
|
883
|
-
}
|
|
897
|
+
x /= 95.047;
|
|
898
|
+
y /= 100;
|
|
899
|
+
z /= 108.883;
|
|
884
900
|
|
|
885
|
-
|
|
901
|
+
x = x > 0.008856 ? Math.pow(x, 1 / 3) : (7.787 * x) + (16 / 116);
|
|
902
|
+
y = y > 0.008856 ? Math.pow(y, 1 / 3) : (7.787 * y) + (16 / 116);
|
|
903
|
+
z = z > 0.008856 ? Math.pow(z, 1 / 3) : (7.787 * z) + (16 / 116);
|
|
886
904
|
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
905
|
+
l = (116 * y) - 16;
|
|
906
|
+
a = 500 * (x - y);
|
|
907
|
+
b = 200 * (y - z);
|
|
908
|
+
|
|
909
|
+
return [l, a, b];
|
|
910
|
+
};
|
|
911
|
+
|
|
912
|
+
convert.hsl.rgb = function (hsl) {
|
|
913
|
+
var h = hsl[0] / 360;
|
|
914
|
+
var s = hsl[1] / 100;
|
|
915
|
+
var l = hsl[2] / 100;
|
|
916
|
+
var t1;
|
|
917
|
+
var t2;
|
|
918
|
+
var t3;
|
|
919
|
+
var rgb;
|
|
920
|
+
var val;
|
|
921
|
+
|
|
922
|
+
if (s === 0) {
|
|
923
|
+
val = l * 255;
|
|
924
|
+
return [val, val, val];
|
|
895
925
|
}
|
|
896
926
|
|
|
897
|
-
if (
|
|
898
|
-
|
|
899
|
-
} else if (2 * t3 < 1) {
|
|
900
|
-
val = t2;
|
|
901
|
-
} else if (3 * t3 < 2) {
|
|
902
|
-
val = t1 + (t2 - t1) * (2 / 3 - t3) * 6;
|
|
927
|
+
if (l < 0.5) {
|
|
928
|
+
t2 = l * (1 + s);
|
|
903
929
|
} else {
|
|
904
|
-
|
|
930
|
+
t2 = l + s - l * s;
|
|
905
931
|
}
|
|
906
932
|
|
|
907
|
-
|
|
908
|
-
}
|
|
933
|
+
t1 = 2 * l - t2;
|
|
909
934
|
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
var sv;
|
|
920
|
-
var v;
|
|
921
|
-
|
|
922
|
-
l *= 2;
|
|
923
|
-
s *= (l <= 1) ? l : 2 - l;
|
|
924
|
-
smin *= lmin <= 1 ? lmin : 2 - lmin;
|
|
925
|
-
v = (l + s) / 2;
|
|
926
|
-
sv = l === 0 ? (2 * smin) / (lmin + smin) : (2 * s) / (l + s);
|
|
927
|
-
|
|
928
|
-
return [h, sv * 100, v * 100];
|
|
929
|
-
};
|
|
935
|
+
rgb = [0, 0, 0];
|
|
936
|
+
for (var i = 0; i < 3; i++) {
|
|
937
|
+
t3 = h + 1 / 3 * -(i - 1);
|
|
938
|
+
if (t3 < 0) {
|
|
939
|
+
t3++;
|
|
940
|
+
}
|
|
941
|
+
if (t3 > 1) {
|
|
942
|
+
t3--;
|
|
943
|
+
}
|
|
930
944
|
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
var t = 255 * v * (1 - (s * (1 - f)));
|
|
941
|
-
v *= 255;
|
|
942
|
-
|
|
943
|
-
switch (hi) {
|
|
944
|
-
case 0:
|
|
945
|
-
return [v, t, p];
|
|
946
|
-
case 1:
|
|
947
|
-
return [q, v, p];
|
|
948
|
-
case 2:
|
|
949
|
-
return [p, v, t];
|
|
950
|
-
case 3:
|
|
951
|
-
return [p, q, v];
|
|
952
|
-
case 4:
|
|
953
|
-
return [t, p, v];
|
|
954
|
-
case 5:
|
|
955
|
-
return [v, p, q];
|
|
956
|
-
}
|
|
957
|
-
};
|
|
945
|
+
if (6 * t3 < 1) {
|
|
946
|
+
val = t1 + (t2 - t1) * 6 * t3;
|
|
947
|
+
} else if (2 * t3 < 1) {
|
|
948
|
+
val = t2;
|
|
949
|
+
} else if (3 * t3 < 2) {
|
|
950
|
+
val = t1 + (t2 - t1) * (2 / 3 - t3) * 6;
|
|
951
|
+
} else {
|
|
952
|
+
val = t1;
|
|
953
|
+
}
|
|
958
954
|
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
var s = hsv[1] / 100;
|
|
962
|
-
var v = hsv[2] / 100;
|
|
963
|
-
var vmin = Math.max(v, 0.01);
|
|
964
|
-
var lmin;
|
|
965
|
-
var sl;
|
|
966
|
-
var l;
|
|
967
|
-
|
|
968
|
-
l = (2 - s) * v;
|
|
969
|
-
lmin = (2 - s) * vmin;
|
|
970
|
-
sl = s * vmin;
|
|
971
|
-
sl /= (lmin <= 1) ? lmin : 2 - lmin;
|
|
972
|
-
sl = sl || 0;
|
|
973
|
-
l /= 2;
|
|
974
|
-
|
|
975
|
-
return [h, sl * 100, l * 100];
|
|
976
|
-
};
|
|
955
|
+
rgb[i] = val * 255;
|
|
956
|
+
}
|
|
977
957
|
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
var h = hwb[0] / 360;
|
|
981
|
-
var wh = hwb[1] / 100;
|
|
982
|
-
var bl = hwb[2] / 100;
|
|
983
|
-
var ratio = wh + bl;
|
|
984
|
-
var i;
|
|
985
|
-
var v;
|
|
986
|
-
var f;
|
|
987
|
-
var n;
|
|
988
|
-
|
|
989
|
-
// wh + bl cant be > 1
|
|
990
|
-
if (ratio > 1) {
|
|
991
|
-
wh /= ratio;
|
|
992
|
-
bl /= ratio;
|
|
993
|
-
}
|
|
958
|
+
return rgb;
|
|
959
|
+
};
|
|
994
960
|
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
961
|
+
convert.hsl.hsv = function (hsl) {
|
|
962
|
+
var h = hsl[0];
|
|
963
|
+
var s = hsl[1] / 100;
|
|
964
|
+
var l = hsl[2] / 100;
|
|
965
|
+
var smin = s;
|
|
966
|
+
var lmin = Math.max(l, 0.01);
|
|
967
|
+
var sv;
|
|
968
|
+
var v;
|
|
969
|
+
|
|
970
|
+
l *= 2;
|
|
971
|
+
s *= (l <= 1) ? l : 2 - l;
|
|
972
|
+
smin *= lmin <= 1 ? lmin : 2 - lmin;
|
|
973
|
+
v = (l + s) / 2;
|
|
974
|
+
sv = l === 0 ? (2 * smin) / (lmin + smin) : (2 * s) / (l + s);
|
|
975
|
+
|
|
976
|
+
return [h, sv * 100, v * 100];
|
|
977
|
+
};
|
|
998
978
|
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
979
|
+
convert.hsv.rgb = function (hsv) {
|
|
980
|
+
var h = hsv[0] / 60;
|
|
981
|
+
var s = hsv[1] / 100;
|
|
982
|
+
var v = hsv[2] / 100;
|
|
983
|
+
var hi = Math.floor(h) % 6;
|
|
984
|
+
|
|
985
|
+
var f = h - Math.floor(h);
|
|
986
|
+
var p = 255 * v * (1 - s);
|
|
987
|
+
var q = 255 * v * (1 - (s * f));
|
|
988
|
+
var t = 255 * v * (1 - (s * (1 - f)));
|
|
989
|
+
v *= 255;
|
|
990
|
+
|
|
991
|
+
switch (hi) {
|
|
992
|
+
case 0:
|
|
993
|
+
return [v, t, p];
|
|
994
|
+
case 1:
|
|
995
|
+
return [q, v, p];
|
|
996
|
+
case 2:
|
|
997
|
+
return [p, v, t];
|
|
998
|
+
case 3:
|
|
999
|
+
return [p, q, v];
|
|
1000
|
+
case 4:
|
|
1001
|
+
return [t, p, v];
|
|
1002
|
+
case 5:
|
|
1003
|
+
return [v, p, q];
|
|
1004
|
+
}
|
|
1005
|
+
};
|
|
1002
1006
|
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1007
|
+
convert.hsv.hsl = function (hsv) {
|
|
1008
|
+
var h = hsv[0];
|
|
1009
|
+
var s = hsv[1] / 100;
|
|
1010
|
+
var v = hsv[2] / 100;
|
|
1011
|
+
var vmin = Math.max(v, 0.01);
|
|
1012
|
+
var lmin;
|
|
1013
|
+
var sl;
|
|
1014
|
+
var l;
|
|
1015
|
+
|
|
1016
|
+
l = (2 - s) * v;
|
|
1017
|
+
lmin = (2 - s) * vmin;
|
|
1018
|
+
sl = s * vmin;
|
|
1019
|
+
sl /= (lmin <= 1) ? lmin : 2 - lmin;
|
|
1020
|
+
sl = sl || 0;
|
|
1021
|
+
l /= 2;
|
|
1022
|
+
|
|
1023
|
+
return [h, sl * 100, l * 100];
|
|
1024
|
+
};
|
|
1018
1025
|
|
|
1019
|
-
|
|
1020
|
-
|
|
1026
|
+
// http://dev.w3.org/csswg/css-color/#hwb-to-rgb
|
|
1027
|
+
convert.hwb.rgb = function (hwb) {
|
|
1028
|
+
var h = hwb[0] / 360;
|
|
1029
|
+
var wh = hwb[1] / 100;
|
|
1030
|
+
var bl = hwb[2] / 100;
|
|
1031
|
+
var ratio = wh + bl;
|
|
1032
|
+
var i;
|
|
1033
|
+
var v;
|
|
1034
|
+
var f;
|
|
1035
|
+
var n;
|
|
1036
|
+
|
|
1037
|
+
// wh + bl cant be > 1
|
|
1038
|
+
if (ratio > 1) {
|
|
1039
|
+
wh /= ratio;
|
|
1040
|
+
bl /= ratio;
|
|
1041
|
+
}
|
|
1021
1042
|
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
var y = cmyk[2] / 100;
|
|
1026
|
-
var k = cmyk[3] / 100;
|
|
1027
|
-
var r;
|
|
1028
|
-
var g;
|
|
1029
|
-
var b;
|
|
1043
|
+
i = Math.floor(6 * h);
|
|
1044
|
+
v = 1 - bl;
|
|
1045
|
+
f = 6 * h - i;
|
|
1030
1046
|
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1047
|
+
if ((i & 0x01) !== 0) {
|
|
1048
|
+
f = 1 - f;
|
|
1049
|
+
}
|
|
1034
1050
|
|
|
1035
|
-
|
|
1036
|
-
|
|
1051
|
+
n = wh + f * (v - wh); // linear interpolation
|
|
1052
|
+
|
|
1053
|
+
var r;
|
|
1054
|
+
var g;
|
|
1055
|
+
var b;
|
|
1056
|
+
switch (i) {
|
|
1057
|
+
default:
|
|
1058
|
+
case 6:
|
|
1059
|
+
case 0: r = v; g = n; b = wh; break;
|
|
1060
|
+
case 1: r = n; g = v; b = wh; break;
|
|
1061
|
+
case 2: r = wh; g = v; b = n; break;
|
|
1062
|
+
case 3: r = wh; g = n; b = v; break;
|
|
1063
|
+
case 4: r = n; g = wh; b = v; break;
|
|
1064
|
+
case 5: r = v; g = wh; b = n; break;
|
|
1065
|
+
}
|
|
1037
1066
|
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
var y = xyz[1] / 100;
|
|
1041
|
-
var z = xyz[2] / 100;
|
|
1042
|
-
var r;
|
|
1043
|
-
var g;
|
|
1044
|
-
var b;
|
|
1067
|
+
return [r * 255, g * 255, b * 255];
|
|
1068
|
+
};
|
|
1045
1069
|
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1070
|
+
convert.cmyk.rgb = function (cmyk) {
|
|
1071
|
+
var c = cmyk[0] / 100;
|
|
1072
|
+
var m = cmyk[1] / 100;
|
|
1073
|
+
var y = cmyk[2] / 100;
|
|
1074
|
+
var k = cmyk[3] / 100;
|
|
1075
|
+
var r;
|
|
1076
|
+
var g;
|
|
1077
|
+
var b;
|
|
1049
1078
|
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
: r * 12.92;
|
|
1079
|
+
r = 1 - Math.min(1, c * (1 - k) + k);
|
|
1080
|
+
g = 1 - Math.min(1, m * (1 - k) + k);
|
|
1081
|
+
b = 1 - Math.min(1, y * (1 - k) + k);
|
|
1054
1082
|
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
: g * 12.92;
|
|
1083
|
+
return [r * 255, g * 255, b * 255];
|
|
1084
|
+
};
|
|
1058
1085
|
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1086
|
+
convert.xyz.rgb = function (xyz) {
|
|
1087
|
+
var x = xyz[0] / 100;
|
|
1088
|
+
var y = xyz[1] / 100;
|
|
1089
|
+
var z = xyz[2] / 100;
|
|
1090
|
+
var r;
|
|
1091
|
+
var g;
|
|
1092
|
+
var b;
|
|
1062
1093
|
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1094
|
+
r = (x * 3.2406) + (y * -1.5372) + (z * -0.4986);
|
|
1095
|
+
g = (x * -0.9689) + (y * 1.8758) + (z * 0.0415);
|
|
1096
|
+
b = (x * 0.0557) + (y * -0.204) + (z * 1.0570);
|
|
1066
1097
|
|
|
1067
|
-
|
|
1068
|
-
|
|
1098
|
+
// assume sRGB
|
|
1099
|
+
r = r > 0.0031308
|
|
1100
|
+
? ((1.055 * Math.pow(r, 1.0 / 2.4)) - 0.055)
|
|
1101
|
+
: r * 12.92;
|
|
1069
1102
|
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
var z = xyz[2];
|
|
1074
|
-
var l;
|
|
1075
|
-
var a;
|
|
1076
|
-
var b;
|
|
1103
|
+
g = g > 0.0031308
|
|
1104
|
+
? ((1.055 * Math.pow(g, 1.0 / 2.4)) - 0.055)
|
|
1105
|
+
: g * 12.92;
|
|
1077
1106
|
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1107
|
+
b = b > 0.0031308
|
|
1108
|
+
? ((1.055 * Math.pow(b, 1.0 / 2.4)) - 0.055)
|
|
1109
|
+
: b * 12.92;
|
|
1081
1110
|
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1111
|
+
r = Math.min(Math.max(0, r), 1);
|
|
1112
|
+
g = Math.min(Math.max(0, g), 1);
|
|
1113
|
+
b = Math.min(Math.max(0, b), 1);
|
|
1085
1114
|
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
b = 200 * (y - z);
|
|
1115
|
+
return [r * 255, g * 255, b * 255];
|
|
1116
|
+
};
|
|
1089
1117
|
|
|
1090
|
-
|
|
1091
|
-
|
|
1118
|
+
convert.xyz.lab = function (xyz) {
|
|
1119
|
+
var x = xyz[0];
|
|
1120
|
+
var y = xyz[1];
|
|
1121
|
+
var z = xyz[2];
|
|
1122
|
+
var l;
|
|
1123
|
+
var a;
|
|
1124
|
+
var b;
|
|
1092
1125
|
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
var b = lab[2];
|
|
1097
|
-
var x;
|
|
1098
|
-
var y;
|
|
1099
|
-
var z;
|
|
1100
|
-
|
|
1101
|
-
y = (l + 16) / 116;
|
|
1102
|
-
x = a / 500 + y;
|
|
1103
|
-
z = y - b / 200;
|
|
1104
|
-
|
|
1105
|
-
var y2 = Math.pow(y, 3);
|
|
1106
|
-
var x2 = Math.pow(x, 3);
|
|
1107
|
-
var z2 = Math.pow(z, 3);
|
|
1108
|
-
y = y2 > 0.008856 ? y2 : (y - 16 / 116) / 7.787;
|
|
1109
|
-
x = x2 > 0.008856 ? x2 : (x - 16 / 116) / 7.787;
|
|
1110
|
-
z = z2 > 0.008856 ? z2 : (z - 16 / 116) / 7.787;
|
|
1111
|
-
|
|
1112
|
-
x *= 95.047;
|
|
1113
|
-
y *= 100;
|
|
1114
|
-
z *= 108.883;
|
|
1115
|
-
|
|
1116
|
-
return [x, y, z];
|
|
1117
|
-
};
|
|
1126
|
+
x /= 95.047;
|
|
1127
|
+
y /= 100;
|
|
1128
|
+
z /= 108.883;
|
|
1118
1129
|
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
var b = lab[2];
|
|
1123
|
-
var hr;
|
|
1124
|
-
var h;
|
|
1125
|
-
var c;
|
|
1130
|
+
x = x > 0.008856 ? Math.pow(x, 1 / 3) : (7.787 * x) + (16 / 116);
|
|
1131
|
+
y = y > 0.008856 ? Math.pow(y, 1 / 3) : (7.787 * y) + (16 / 116);
|
|
1132
|
+
z = z > 0.008856 ? Math.pow(z, 1 / 3) : (7.787 * z) + (16 / 116);
|
|
1126
1133
|
|
|
1127
|
-
|
|
1128
|
-
|
|
1134
|
+
l = (116 * y) - 16;
|
|
1135
|
+
a = 500 * (x - y);
|
|
1136
|
+
b = 200 * (y - z);
|
|
1129
1137
|
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
}
|
|
1138
|
+
return [l, a, b];
|
|
1139
|
+
};
|
|
1133
1140
|
|
|
1134
|
-
|
|
1141
|
+
convert.lab.xyz = function (lab) {
|
|
1142
|
+
var l = lab[0];
|
|
1143
|
+
var a = lab[1];
|
|
1144
|
+
var b = lab[2];
|
|
1145
|
+
var x;
|
|
1146
|
+
var y;
|
|
1147
|
+
var z;
|
|
1148
|
+
|
|
1149
|
+
y = (l + 16) / 116;
|
|
1150
|
+
x = a / 500 + y;
|
|
1151
|
+
z = y - b / 200;
|
|
1152
|
+
|
|
1153
|
+
var y2 = Math.pow(y, 3);
|
|
1154
|
+
var x2 = Math.pow(x, 3);
|
|
1155
|
+
var z2 = Math.pow(z, 3);
|
|
1156
|
+
y = y2 > 0.008856 ? y2 : (y - 16 / 116) / 7.787;
|
|
1157
|
+
x = x2 > 0.008856 ? x2 : (x - 16 / 116) / 7.787;
|
|
1158
|
+
z = z2 > 0.008856 ? z2 : (z - 16 / 116) / 7.787;
|
|
1159
|
+
|
|
1160
|
+
x *= 95.047;
|
|
1161
|
+
y *= 100;
|
|
1162
|
+
z *= 108.883;
|
|
1163
|
+
|
|
1164
|
+
return [x, y, z];
|
|
1165
|
+
};
|
|
1135
1166
|
|
|
1136
|
-
|
|
1137
|
-
|
|
1167
|
+
convert.lab.lch = function (lab) {
|
|
1168
|
+
var l = lab[0];
|
|
1169
|
+
var a = lab[1];
|
|
1170
|
+
var b = lab[2];
|
|
1171
|
+
var hr;
|
|
1172
|
+
var h;
|
|
1173
|
+
var c;
|
|
1138
1174
|
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
var c = lch[1];
|
|
1142
|
-
var h = lch[2];
|
|
1143
|
-
var a;
|
|
1144
|
-
var b;
|
|
1145
|
-
var hr;
|
|
1175
|
+
hr = Math.atan2(b, a);
|
|
1176
|
+
h = hr * 360 / 2 / Math.PI;
|
|
1146
1177
|
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1178
|
+
if (h < 0) {
|
|
1179
|
+
h += 360;
|
|
1180
|
+
}
|
|
1150
1181
|
|
|
1151
|
-
|
|
1152
|
-
};
|
|
1182
|
+
c = Math.sqrt(a * a + b * b);
|
|
1153
1183
|
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
var g = args[1];
|
|
1157
|
-
var b = args[2];
|
|
1158
|
-
var value = 1 in arguments ? arguments[1] : convert$2.rgb.hsv(args)[2]; // hsv -> ansi16 optimization
|
|
1184
|
+
return [l, c, h];
|
|
1185
|
+
};
|
|
1159
1186
|
|
|
1160
|
-
|
|
1187
|
+
convert.lch.lab = function (lch) {
|
|
1188
|
+
var l = lch[0];
|
|
1189
|
+
var c = lch[1];
|
|
1190
|
+
var h = lch[2];
|
|
1191
|
+
var a;
|
|
1192
|
+
var b;
|
|
1193
|
+
var hr;
|
|
1161
1194
|
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1195
|
+
hr = h / 360 * 2 * Math.PI;
|
|
1196
|
+
a = c * Math.cos(hr);
|
|
1197
|
+
b = c * Math.sin(hr);
|
|
1165
1198
|
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
| (Math.round(g / 255) << 1)
|
|
1169
|
-
| Math.round(r / 255));
|
|
1199
|
+
return [l, a, b];
|
|
1200
|
+
};
|
|
1170
1201
|
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1202
|
+
convert.rgb.ansi16 = function (args) {
|
|
1203
|
+
var r = args[0];
|
|
1204
|
+
var g = args[1];
|
|
1205
|
+
var b = args[2];
|
|
1206
|
+
var value = 1 in arguments ? arguments[1] : convert.rgb.hsv(args)[2]; // hsv -> ansi16 optimization
|
|
1174
1207
|
|
|
1175
|
-
|
|
1176
|
-
};
|
|
1208
|
+
value = Math.round(value / 50);
|
|
1177
1209
|
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
return convert$2.rgb.ansi16(convert$2.hsv.rgb(args), args[2]);
|
|
1182
|
-
};
|
|
1210
|
+
if (value === 0) {
|
|
1211
|
+
return 30;
|
|
1212
|
+
}
|
|
1183
1213
|
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1214
|
+
var ansi = 30
|
|
1215
|
+
+ ((Math.round(b / 255) << 2)
|
|
1216
|
+
| (Math.round(g / 255) << 1)
|
|
1217
|
+
| Math.round(r / 255));
|
|
1188
1218
|
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
if (r === g && g === b) {
|
|
1192
|
-
if (r < 8) {
|
|
1193
|
-
return 16;
|
|
1219
|
+
if (value === 2) {
|
|
1220
|
+
ansi += 60;
|
|
1194
1221
|
}
|
|
1195
1222
|
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
}
|
|
1223
|
+
return ansi;
|
|
1224
|
+
};
|
|
1199
1225
|
|
|
1200
|
-
|
|
1201
|
-
|
|
1226
|
+
convert.hsv.ansi16 = function (args) {
|
|
1227
|
+
// optimization here; we already know the value and don't need to get
|
|
1228
|
+
// it converted for us.
|
|
1229
|
+
return convert.rgb.ansi16(convert.hsv.rgb(args), args[2]);
|
|
1230
|
+
};
|
|
1202
1231
|
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1232
|
+
convert.rgb.ansi256 = function (args) {
|
|
1233
|
+
var r = args[0];
|
|
1234
|
+
var g = args[1];
|
|
1235
|
+
var b = args[2];
|
|
1207
1236
|
|
|
1208
|
-
|
|
1209
|
-
|
|
1237
|
+
// we use the extended greyscale palette here, with the exception of
|
|
1238
|
+
// black and white. normal palette only has 4 greyscale shades.
|
|
1239
|
+
if (r === g && g === b) {
|
|
1240
|
+
if (r < 8) {
|
|
1241
|
+
return 16;
|
|
1242
|
+
}
|
|
1210
1243
|
|
|
1211
|
-
|
|
1212
|
-
|
|
1244
|
+
if (r > 248) {
|
|
1245
|
+
return 231;
|
|
1246
|
+
}
|
|
1213
1247
|
|
|
1214
|
-
|
|
1215
|
-
if (color === 0 || color === 7) {
|
|
1216
|
-
if (args > 50) {
|
|
1217
|
-
color += 3.5;
|
|
1248
|
+
return Math.round(((r - 8) / 247) * 24) + 232;
|
|
1218
1249
|
}
|
|
1219
1250
|
|
|
1220
|
-
|
|
1251
|
+
var ansi = 16
|
|
1252
|
+
+ (36 * Math.round(r / 255 * 5))
|
|
1253
|
+
+ (6 * Math.round(g / 255 * 5))
|
|
1254
|
+
+ Math.round(b / 255 * 5);
|
|
1221
1255
|
|
|
1222
|
-
return
|
|
1223
|
-
}
|
|
1256
|
+
return ansi;
|
|
1257
|
+
};
|
|
1224
1258
|
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
var g = (((color >> 1) & 1) * mult) * 255;
|
|
1228
|
-
var b = (((color >> 2) & 1) * mult) * 255;
|
|
1259
|
+
convert.ansi16.rgb = function (args) {
|
|
1260
|
+
var color = args % 10;
|
|
1229
1261
|
|
|
1230
|
-
|
|
1231
|
-
|
|
1262
|
+
// handle greyscale
|
|
1263
|
+
if (color === 0 || color === 7) {
|
|
1264
|
+
if (args > 50) {
|
|
1265
|
+
color += 3.5;
|
|
1266
|
+
}
|
|
1232
1267
|
|
|
1233
|
-
|
|
1234
|
-
// handle greyscale
|
|
1235
|
-
if (args >= 232) {
|
|
1236
|
-
var c = (args - 232) * 10 + 8;
|
|
1237
|
-
return [c, c, c];
|
|
1238
|
-
}
|
|
1268
|
+
color = color / 10.5 * 255;
|
|
1239
1269
|
|
|
1240
|
-
|
|
1270
|
+
return [color, color, color];
|
|
1271
|
+
}
|
|
1241
1272
|
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1273
|
+
var mult = (~~(args > 50) + 1) * 0.5;
|
|
1274
|
+
var r = ((color & 1) * mult) * 255;
|
|
1275
|
+
var g = (((color >> 1) & 1) * mult) * 255;
|
|
1276
|
+
var b = (((color >> 2) & 1) * mult) * 255;
|
|
1246
1277
|
|
|
1247
|
-
|
|
1248
|
-
};
|
|
1278
|
+
return [r, g, b];
|
|
1279
|
+
};
|
|
1249
1280
|
|
|
1250
|
-
convert
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1281
|
+
convert.ansi256.rgb = function (args) {
|
|
1282
|
+
// handle greyscale
|
|
1283
|
+
if (args >= 232) {
|
|
1284
|
+
var c = (args - 232) * 10 + 8;
|
|
1285
|
+
return [c, c, c];
|
|
1286
|
+
}
|
|
1254
1287
|
|
|
1255
|
-
|
|
1256
|
-
return '000000'.substring(string.length) + string;
|
|
1257
|
-
};
|
|
1288
|
+
args -= 16;
|
|
1258
1289
|
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
}
|
|
1290
|
+
var rem;
|
|
1291
|
+
var r = Math.floor(args / 36) / 5 * 255;
|
|
1292
|
+
var g = Math.floor((rem = args % 36) / 6) / 5 * 255;
|
|
1293
|
+
var b = (rem % 6) / 5 * 255;
|
|
1264
1294
|
|
|
1265
|
-
|
|
1295
|
+
return [r, g, b];
|
|
1296
|
+
};
|
|
1266
1297
|
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
}
|
|
1298
|
+
convert.rgb.hex = function (args) {
|
|
1299
|
+
var integer = ((Math.round(args[0]) & 0xFF) << 16)
|
|
1300
|
+
+ ((Math.round(args[1]) & 0xFF) << 8)
|
|
1301
|
+
+ (Math.round(args[2]) & 0xFF);
|
|
1272
1302
|
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
var b = integer & 0xFF;
|
|
1303
|
+
var string = integer.toString(16).toUpperCase();
|
|
1304
|
+
return '000000'.substring(string.length) + string;
|
|
1305
|
+
};
|
|
1277
1306
|
|
|
1278
|
-
|
|
1279
|
-
};
|
|
1307
|
+
convert.hex.rgb = function (args) {
|
|
1308
|
+
var match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);
|
|
1309
|
+
if (!match) {
|
|
1310
|
+
return [0, 0, 0];
|
|
1311
|
+
}
|
|
1280
1312
|
|
|
1281
|
-
|
|
1282
|
-
var r = rgb[0] / 255;
|
|
1283
|
-
var g = rgb[1] / 255;
|
|
1284
|
-
var b = rgb[2] / 255;
|
|
1285
|
-
var max = Math.max(Math.max(r, g), b);
|
|
1286
|
-
var min = Math.min(Math.min(r, g), b);
|
|
1287
|
-
var chroma = (max - min);
|
|
1288
|
-
var grayscale;
|
|
1289
|
-
var hue;
|
|
1290
|
-
|
|
1291
|
-
if (chroma < 1) {
|
|
1292
|
-
grayscale = min / (1 - chroma);
|
|
1293
|
-
} else {
|
|
1294
|
-
grayscale = 0;
|
|
1295
|
-
}
|
|
1313
|
+
var colorString = match[0];
|
|
1296
1314
|
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
} else
|
|
1303
|
-
if (max === g) {
|
|
1304
|
-
hue = 2 + (b - r) / chroma;
|
|
1305
|
-
} else {
|
|
1306
|
-
hue = 4 + (r - g) / chroma + 4;
|
|
1307
|
-
}
|
|
1315
|
+
if (match[0].length === 3) {
|
|
1316
|
+
colorString = colorString.split('').map(function (char) {
|
|
1317
|
+
return char + char;
|
|
1318
|
+
}).join('');
|
|
1319
|
+
}
|
|
1308
1320
|
|
|
1309
|
-
|
|
1310
|
-
|
|
1321
|
+
var integer = parseInt(colorString, 16);
|
|
1322
|
+
var r = (integer >> 16) & 0xFF;
|
|
1323
|
+
var g = (integer >> 8) & 0xFF;
|
|
1324
|
+
var b = integer & 0xFF;
|
|
1311
1325
|
|
|
1312
|
-
|
|
1313
|
-
};
|
|
1326
|
+
return [r, g, b];
|
|
1327
|
+
};
|
|
1314
1328
|
|
|
1315
|
-
convert
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1329
|
+
convert.rgb.hcg = function (rgb) {
|
|
1330
|
+
var r = rgb[0] / 255;
|
|
1331
|
+
var g = rgb[1] / 255;
|
|
1332
|
+
var b = rgb[2] / 255;
|
|
1333
|
+
var max = Math.max(Math.max(r, g), b);
|
|
1334
|
+
var min = Math.min(Math.min(r, g), b);
|
|
1335
|
+
var chroma = (max - min);
|
|
1336
|
+
var grayscale;
|
|
1337
|
+
var hue;
|
|
1338
|
+
|
|
1339
|
+
if (chroma < 1) {
|
|
1340
|
+
grayscale = min / (1 - chroma);
|
|
1341
|
+
} else {
|
|
1342
|
+
grayscale = 0;
|
|
1343
|
+
}
|
|
1320
1344
|
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1345
|
+
if (chroma <= 0) {
|
|
1346
|
+
hue = 0;
|
|
1347
|
+
} else
|
|
1348
|
+
if (max === r) {
|
|
1349
|
+
hue = ((g - b) / chroma) % 6;
|
|
1350
|
+
} else
|
|
1351
|
+
if (max === g) {
|
|
1352
|
+
hue = 2 + (b - r) / chroma;
|
|
1353
|
+
} else {
|
|
1354
|
+
hue = 4 + (r - g) / chroma + 4;
|
|
1355
|
+
}
|
|
1326
1356
|
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
}
|
|
1357
|
+
hue /= 6;
|
|
1358
|
+
hue %= 1;
|
|
1330
1359
|
|
|
1331
|
-
|
|
1332
|
-
};
|
|
1360
|
+
return [hue * 360, chroma * 100, grayscale * 100];
|
|
1361
|
+
};
|
|
1333
1362
|
|
|
1334
|
-
convert
|
|
1335
|
-
|
|
1336
|
-
|
|
1363
|
+
convert.hsl.hcg = function (hsl) {
|
|
1364
|
+
var s = hsl[1] / 100;
|
|
1365
|
+
var l = hsl[2] / 100;
|
|
1366
|
+
var c = 1;
|
|
1367
|
+
var f = 0;
|
|
1337
1368
|
|
|
1338
|
-
|
|
1339
|
-
|
|
1369
|
+
if (l < 0.5) {
|
|
1370
|
+
c = 2.0 * s * l;
|
|
1371
|
+
} else {
|
|
1372
|
+
c = 2.0 * s * (1.0 - l);
|
|
1373
|
+
}
|
|
1340
1374
|
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1375
|
+
if (c < 1.0) {
|
|
1376
|
+
f = (l - 0.5 * c) / (1.0 - c);
|
|
1377
|
+
}
|
|
1344
1378
|
|
|
1345
|
-
|
|
1346
|
-
};
|
|
1379
|
+
return [hsl[0], c * 100, f * 100];
|
|
1380
|
+
};
|
|
1347
1381
|
|
|
1348
|
-
convert
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
var g = hcg[2] / 100;
|
|
1382
|
+
convert.hsv.hcg = function (hsv) {
|
|
1383
|
+
var s = hsv[1] / 100;
|
|
1384
|
+
var v = hsv[2] / 100;
|
|
1352
1385
|
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
}
|
|
1386
|
+
var c = s * v;
|
|
1387
|
+
var f = 0;
|
|
1356
1388
|
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
var w = 1 - v;
|
|
1361
|
-
var mg = 0;
|
|
1362
|
-
|
|
1363
|
-
switch (Math.floor(hi)) {
|
|
1364
|
-
case 0:
|
|
1365
|
-
pure[0] = 1; pure[1] = v; pure[2] = 0; break;
|
|
1366
|
-
case 1:
|
|
1367
|
-
pure[0] = w; pure[1] = 1; pure[2] = 0; break;
|
|
1368
|
-
case 2:
|
|
1369
|
-
pure[0] = 0; pure[1] = 1; pure[2] = v; break;
|
|
1370
|
-
case 3:
|
|
1371
|
-
pure[0] = 0; pure[1] = w; pure[2] = 1; break;
|
|
1372
|
-
case 4:
|
|
1373
|
-
pure[0] = v; pure[1] = 0; pure[2] = 1; break;
|
|
1374
|
-
default:
|
|
1375
|
-
pure[0] = 1; pure[1] = 0; pure[2] = w;
|
|
1376
|
-
}
|
|
1389
|
+
if (c < 1.0) {
|
|
1390
|
+
f = (v - c) / (1 - c);
|
|
1391
|
+
}
|
|
1377
1392
|
|
|
1378
|
-
|
|
1393
|
+
return [hsv[0], c * 100, f * 100];
|
|
1394
|
+
};
|
|
1379
1395
|
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
];
|
|
1385
|
-
};
|
|
1396
|
+
convert.hcg.rgb = function (hcg) {
|
|
1397
|
+
var h = hcg[0] / 360;
|
|
1398
|
+
var c = hcg[1] / 100;
|
|
1399
|
+
var g = hcg[2] / 100;
|
|
1386
1400
|
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1401
|
+
if (c === 0.0) {
|
|
1402
|
+
return [g * 255, g * 255, g * 255];
|
|
1403
|
+
}
|
|
1390
1404
|
|
|
1391
|
-
|
|
1392
|
-
|
|
1405
|
+
var pure = [0, 0, 0];
|
|
1406
|
+
var hi = (h % 1) * 6;
|
|
1407
|
+
var v = hi % 1;
|
|
1408
|
+
var w = 1 - v;
|
|
1409
|
+
var mg = 0;
|
|
1410
|
+
|
|
1411
|
+
switch (Math.floor(hi)) {
|
|
1412
|
+
case 0:
|
|
1413
|
+
pure[0] = 1; pure[1] = v; pure[2] = 0; break;
|
|
1414
|
+
case 1:
|
|
1415
|
+
pure[0] = w; pure[1] = 1; pure[2] = 0; break;
|
|
1416
|
+
case 2:
|
|
1417
|
+
pure[0] = 0; pure[1] = 1; pure[2] = v; break;
|
|
1418
|
+
case 3:
|
|
1419
|
+
pure[0] = 0; pure[1] = w; pure[2] = 1; break;
|
|
1420
|
+
case 4:
|
|
1421
|
+
pure[0] = v; pure[1] = 0; pure[2] = 1; break;
|
|
1422
|
+
default:
|
|
1423
|
+
pure[0] = 1; pure[1] = 0; pure[2] = w;
|
|
1424
|
+
}
|
|
1393
1425
|
|
|
1394
|
-
|
|
1395
|
-
f = c / v;
|
|
1396
|
-
}
|
|
1426
|
+
mg = (1.0 - c) * g;
|
|
1397
1427
|
|
|
1398
|
-
|
|
1399
|
-
|
|
1428
|
+
return [
|
|
1429
|
+
(c * pure[0] + mg) * 255,
|
|
1430
|
+
(c * pure[1] + mg) * 255,
|
|
1431
|
+
(c * pure[2] + mg) * 255
|
|
1432
|
+
];
|
|
1433
|
+
};
|
|
1400
1434
|
|
|
1401
|
-
convert
|
|
1402
|
-
|
|
1403
|
-
|
|
1435
|
+
convert.hcg.hsv = function (hcg) {
|
|
1436
|
+
var c = hcg[1] / 100;
|
|
1437
|
+
var g = hcg[2] / 100;
|
|
1404
1438
|
|
|
1405
|
-
|
|
1406
|
-
|
|
1439
|
+
var v = c + g * (1.0 - c);
|
|
1440
|
+
var f = 0;
|
|
1407
1441
|
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
if (l >= 0.5 && l < 1.0) {
|
|
1412
|
-
s = c / (2 * (1 - l));
|
|
1413
|
-
}
|
|
1442
|
+
if (v > 0.0) {
|
|
1443
|
+
f = c / v;
|
|
1444
|
+
}
|
|
1414
1445
|
|
|
1415
|
-
|
|
1416
|
-
};
|
|
1446
|
+
return [hcg[0], f * 100, v * 100];
|
|
1447
|
+
};
|
|
1417
1448
|
|
|
1418
|
-
convert
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
var v = c + g * (1.0 - c);
|
|
1422
|
-
return [hcg[0], (v - c) * 100, (1 - v) * 100];
|
|
1423
|
-
};
|
|
1449
|
+
convert.hcg.hsl = function (hcg) {
|
|
1450
|
+
var c = hcg[1] / 100;
|
|
1451
|
+
var g = hcg[2] / 100;
|
|
1424
1452
|
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
var b = hwb[2] / 100;
|
|
1428
|
-
var v = 1 - b;
|
|
1429
|
-
var c = v - w;
|
|
1430
|
-
var g = 0;
|
|
1453
|
+
var l = g * (1.0 - c) + 0.5 * c;
|
|
1454
|
+
var s = 0;
|
|
1431
1455
|
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1456
|
+
if (l > 0.0 && l < 0.5) {
|
|
1457
|
+
s = c / (2 * l);
|
|
1458
|
+
} else
|
|
1459
|
+
if (l >= 0.5 && l < 1.0) {
|
|
1460
|
+
s = c / (2 * (1 - l));
|
|
1461
|
+
}
|
|
1435
1462
|
|
|
1436
|
-
|
|
1437
|
-
};
|
|
1463
|
+
return [hcg[0], s * 100, l * 100];
|
|
1464
|
+
};
|
|
1438
1465
|
|
|
1439
|
-
convert
|
|
1440
|
-
|
|
1441
|
-
|
|
1466
|
+
convert.hcg.hwb = function (hcg) {
|
|
1467
|
+
var c = hcg[1] / 100;
|
|
1468
|
+
var g = hcg[2] / 100;
|
|
1469
|
+
var v = c + g * (1.0 - c);
|
|
1470
|
+
return [hcg[0], (v - c) * 100, (1 - v) * 100];
|
|
1471
|
+
};
|
|
1442
1472
|
|
|
1443
|
-
convert
|
|
1444
|
-
|
|
1445
|
-
|
|
1473
|
+
convert.hwb.hcg = function (hwb) {
|
|
1474
|
+
var w = hwb[1] / 100;
|
|
1475
|
+
var b = hwb[2] / 100;
|
|
1476
|
+
var v = 1 - b;
|
|
1477
|
+
var c = v - w;
|
|
1478
|
+
var g = 0;
|
|
1446
1479
|
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
}
|
|
1480
|
+
if (c < 1) {
|
|
1481
|
+
g = (v - c) / (1 - c);
|
|
1482
|
+
}
|
|
1450
1483
|
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
};
|
|
1484
|
+
return [hwb[0], c * 100, g * 100];
|
|
1485
|
+
};
|
|
1454
1486
|
|
|
1455
|
-
convert
|
|
1456
|
-
|
|
1457
|
-
};
|
|
1487
|
+
convert.apple.rgb = function (apple) {
|
|
1488
|
+
return [(apple[0] / 65535) * 255, (apple[1] / 65535) * 255, (apple[2] / 65535) * 255];
|
|
1489
|
+
};
|
|
1458
1490
|
|
|
1459
|
-
convert
|
|
1460
|
-
|
|
1461
|
-
};
|
|
1491
|
+
convert.rgb.apple = function (rgb) {
|
|
1492
|
+
return [(rgb[0] / 255) * 65535, (rgb[1] / 255) * 65535, (rgb[2] / 255) * 65535];
|
|
1493
|
+
};
|
|
1462
1494
|
|
|
1463
|
-
convert
|
|
1464
|
-
|
|
1465
|
-
};
|
|
1495
|
+
convert.gray.rgb = function (args) {
|
|
1496
|
+
return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255];
|
|
1497
|
+
};
|
|
1466
1498
|
|
|
1467
|
-
convert
|
|
1468
|
-
|
|
1469
|
-
|
|
1499
|
+
convert.gray.hsl = convert.gray.hsv = function (args) {
|
|
1500
|
+
return [0, 0, args[0]];
|
|
1501
|
+
};
|
|
1470
1502
|
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
};
|
|
1503
|
+
convert.gray.hwb = function (gray) {
|
|
1504
|
+
return [0, 100, gray[0]];
|
|
1505
|
+
};
|
|
1474
1506
|
|
|
1475
|
-
convert
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
};
|
|
1507
|
+
convert.gray.cmyk = function (gray) {
|
|
1508
|
+
return [0, 0, 0, gray[0]];
|
|
1509
|
+
};
|
|
1479
1510
|
|
|
1480
|
-
|
|
1511
|
+
convert.gray.lab = function (gray) {
|
|
1512
|
+
return [gray[0], 0, 0];
|
|
1513
|
+
};
|
|
1481
1514
|
|
|
1482
|
-
|
|
1483
|
-
|
|
1515
|
+
convert.gray.hex = function (gray) {
|
|
1516
|
+
var val = Math.round(gray[0] / 100 * 255) & 0xFF;
|
|
1517
|
+
var integer = (val << 16) + (val << 8) + val;
|
|
1484
1518
|
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
color models (inclusive).
|
|
1519
|
+
var string = integer.toString(16).toUpperCase();
|
|
1520
|
+
return '000000'.substring(string.length) + string;
|
|
1521
|
+
};
|
|
1489
1522
|
|
|
1490
|
-
|
|
1491
|
-
|
|
1523
|
+
convert.rgb.gray = function (rgb) {
|
|
1524
|
+
var val = (rgb[0] + rgb[1] + rgb[2]) / 3;
|
|
1525
|
+
return [val / 255 * 100];
|
|
1526
|
+
};
|
|
1527
|
+
return conversions.exports;
|
|
1528
|
+
}
|
|
1492
1529
|
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1530
|
+
var route;
|
|
1531
|
+
var hasRequiredRoute;
|
|
1532
|
+
|
|
1533
|
+
function requireRoute () {
|
|
1534
|
+
if (hasRequiredRoute) return route;
|
|
1535
|
+
hasRequiredRoute = 1;
|
|
1536
|
+
var conversions = requireConversions();
|
|
1537
|
+
|
|
1538
|
+
/*
|
|
1539
|
+
this function routes a model to all other models.
|
|
1540
|
+
|
|
1541
|
+
all functions that are routed have a property `.conversion` attached
|
|
1542
|
+
to the returned synthetic function. This property is an array
|
|
1543
|
+
of strings, each with the steps in between the 'from' and 'to'
|
|
1544
|
+
color models (inclusive).
|
|
1545
|
+
|
|
1546
|
+
conversions that are not possible simply are not included.
|
|
1547
|
+
*/
|
|
1548
|
+
|
|
1549
|
+
function buildGraph() {
|
|
1550
|
+
var graph = {};
|
|
1551
|
+
// https://jsperf.com/object-keys-vs-for-in-with-closure/3
|
|
1552
|
+
var models = Object.keys(conversions);
|
|
1553
|
+
|
|
1554
|
+
for (var len = models.length, i = 0; i < len; i++) {
|
|
1555
|
+
graph[models[i]] = {
|
|
1556
|
+
// http://jsperf.com/1-vs-infinity
|
|
1557
|
+
// micro-opt, but this is simple.
|
|
1558
|
+
distance: -1,
|
|
1559
|
+
parent: null
|
|
1560
|
+
};
|
|
1561
|
+
}
|
|
1497
1562
|
|
|
1498
|
-
|
|
1499
|
-
graph[models[i]] = {
|
|
1500
|
-
// http://jsperf.com/1-vs-infinity
|
|
1501
|
-
// micro-opt, but this is simple.
|
|
1502
|
-
distance: -1,
|
|
1503
|
-
parent: null
|
|
1504
|
-
};
|
|
1563
|
+
return graph;
|
|
1505
1564
|
}
|
|
1506
1565
|
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
//
|
|
1511
|
-
function deriveBFS(fromModel) {
|
|
1512
|
-
var graph = buildGraph();
|
|
1513
|
-
var queue = [fromModel]; // unshift -> queue -> pop
|
|
1566
|
+
// https://en.wikipedia.org/wiki/Breadth-first_search
|
|
1567
|
+
function deriveBFS(fromModel) {
|
|
1568
|
+
var graph = buildGraph();
|
|
1569
|
+
var queue = [fromModel]; // unshift -> queue -> pop
|
|
1514
1570
|
|
|
1515
|
-
|
|
1571
|
+
graph[fromModel].distance = 0;
|
|
1516
1572
|
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1573
|
+
while (queue.length) {
|
|
1574
|
+
var current = queue.pop();
|
|
1575
|
+
var adjacents = Object.keys(conversions[current]);
|
|
1520
1576
|
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1577
|
+
for (var len = adjacents.length, i = 0; i < len; i++) {
|
|
1578
|
+
var adjacent = adjacents[i];
|
|
1579
|
+
var node = graph[adjacent];
|
|
1524
1580
|
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1581
|
+
if (node.distance === -1) {
|
|
1582
|
+
node.distance = graph[current].distance + 1;
|
|
1583
|
+
node.parent = current;
|
|
1584
|
+
queue.unshift(adjacent);
|
|
1585
|
+
}
|
|
1529
1586
|
}
|
|
1530
1587
|
}
|
|
1588
|
+
|
|
1589
|
+
return graph;
|
|
1531
1590
|
}
|
|
1532
1591
|
|
|
1533
|
-
|
|
1534
|
-
|
|
1592
|
+
function link(from, to) {
|
|
1593
|
+
return function (args) {
|
|
1594
|
+
return to(from(args));
|
|
1595
|
+
};
|
|
1596
|
+
}
|
|
1535
1597
|
|
|
1536
|
-
function
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
};
|
|
1540
|
-
}
|
|
1598
|
+
function wrapConversion(toModel, graph) {
|
|
1599
|
+
var path = [graph[toModel].parent, toModel];
|
|
1600
|
+
var fn = conversions[graph[toModel].parent][toModel];
|
|
1541
1601
|
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1602
|
+
var cur = graph[toModel].parent;
|
|
1603
|
+
while (graph[cur].parent) {
|
|
1604
|
+
path.unshift(graph[cur].parent);
|
|
1605
|
+
fn = link(conversions[graph[cur].parent][cur], fn);
|
|
1606
|
+
cur = graph[cur].parent;
|
|
1607
|
+
}
|
|
1545
1608
|
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
path.unshift(graph[cur].parent);
|
|
1549
|
-
fn = link(conversions$1[graph[cur].parent][cur], fn);
|
|
1550
|
-
cur = graph[cur].parent;
|
|
1609
|
+
fn.conversion = path;
|
|
1610
|
+
return fn;
|
|
1551
1611
|
}
|
|
1552
1612
|
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
}
|
|
1613
|
+
route = function (fromModel) {
|
|
1614
|
+
var graph = deriveBFS(fromModel);
|
|
1615
|
+
var conversion = {};
|
|
1556
1616
|
|
|
1557
|
-
var
|
|
1558
|
-
|
|
1559
|
-
|
|
1617
|
+
var models = Object.keys(graph);
|
|
1618
|
+
for (var len = models.length, i = 0; i < len; i++) {
|
|
1619
|
+
var toModel = models[i];
|
|
1620
|
+
var node = graph[toModel];
|
|
1560
1621
|
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1622
|
+
if (node.parent === null) {
|
|
1623
|
+
// no possible conversion, or this node is the source model.
|
|
1624
|
+
continue;
|
|
1625
|
+
}
|
|
1565
1626
|
|
|
1566
|
-
|
|
1567
|
-
// no possible conversion, or this node is the source model.
|
|
1568
|
-
continue;
|
|
1627
|
+
conversion[toModel] = wrapConversion(toModel, graph);
|
|
1569
1628
|
}
|
|
1570
1629
|
|
|
1571
|
-
conversion
|
|
1572
|
-
}
|
|
1630
|
+
return conversion;
|
|
1631
|
+
};
|
|
1632
|
+
return route;
|
|
1633
|
+
}
|
|
1573
1634
|
|
|
1574
|
-
|
|
1575
|
-
|
|
1635
|
+
var colorConvert;
|
|
1636
|
+
var hasRequiredColorConvert;
|
|
1576
1637
|
|
|
1577
|
-
|
|
1578
|
-
|
|
1638
|
+
function requireColorConvert () {
|
|
1639
|
+
if (hasRequiredColorConvert) return colorConvert;
|
|
1640
|
+
hasRequiredColorConvert = 1;
|
|
1641
|
+
var conversions = requireConversions();
|
|
1642
|
+
var route = requireRoute();
|
|
1579
1643
|
|
|
1580
|
-
var convert
|
|
1644
|
+
var convert = {};
|
|
1581
1645
|
|
|
1582
|
-
var models = Object.keys(conversions);
|
|
1646
|
+
var models = Object.keys(conversions);
|
|
1583
1647
|
|
|
1584
|
-
function wrapRaw(fn) {
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1648
|
+
function wrapRaw(fn) {
|
|
1649
|
+
var wrappedFn = function (args) {
|
|
1650
|
+
if (args === undefined || args === null) {
|
|
1651
|
+
return args;
|
|
1652
|
+
}
|
|
1589
1653
|
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1654
|
+
if (arguments.length > 1) {
|
|
1655
|
+
args = Array.prototype.slice.call(arguments);
|
|
1656
|
+
}
|
|
1593
1657
|
|
|
1594
|
-
|
|
1595
|
-
|
|
1658
|
+
return fn(args);
|
|
1659
|
+
};
|
|
1596
1660
|
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1661
|
+
// preserve .conversion property if there is one
|
|
1662
|
+
if ('conversion' in fn) {
|
|
1663
|
+
wrappedFn.conversion = fn.conversion;
|
|
1664
|
+
}
|
|
1601
1665
|
|
|
1602
|
-
|
|
1603
|
-
}
|
|
1666
|
+
return wrappedFn;
|
|
1667
|
+
}
|
|
1604
1668
|
|
|
1605
|
-
function wrapRounded(fn) {
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1669
|
+
function wrapRounded(fn) {
|
|
1670
|
+
var wrappedFn = function (args) {
|
|
1671
|
+
if (args === undefined || args === null) {
|
|
1672
|
+
return args;
|
|
1673
|
+
}
|
|
1610
1674
|
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1675
|
+
if (arguments.length > 1) {
|
|
1676
|
+
args = Array.prototype.slice.call(arguments);
|
|
1677
|
+
}
|
|
1614
1678
|
|
|
1615
|
-
|
|
1679
|
+
var result = fn(args);
|
|
1616
1680
|
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1681
|
+
// we're assuming the result is an array here.
|
|
1682
|
+
// see notice in conversions.js; don't use box types
|
|
1683
|
+
// in conversion functions.
|
|
1684
|
+
if (typeof result === 'object') {
|
|
1685
|
+
for (var len = result.length, i = 0; i < len; i++) {
|
|
1686
|
+
result[i] = Math.round(result[i]);
|
|
1687
|
+
}
|
|
1623
1688
|
}
|
|
1624
|
-
}
|
|
1625
1689
|
|
|
1626
|
-
|
|
1627
|
-
|
|
1690
|
+
return result;
|
|
1691
|
+
};
|
|
1628
1692
|
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1693
|
+
// preserve .conversion property if there is one
|
|
1694
|
+
if ('conversion' in fn) {
|
|
1695
|
+
wrappedFn.conversion = fn.conversion;
|
|
1696
|
+
}
|
|
1633
1697
|
|
|
1634
|
-
|
|
1635
|
-
}
|
|
1698
|
+
return wrappedFn;
|
|
1699
|
+
}
|
|
1636
1700
|
|
|
1637
|
-
models.forEach(function (fromModel) {
|
|
1638
|
-
|
|
1701
|
+
models.forEach(function (fromModel) {
|
|
1702
|
+
convert[fromModel] = {};
|
|
1639
1703
|
|
|
1640
|
-
|
|
1641
|
-
|
|
1704
|
+
Object.defineProperty(convert[fromModel], 'channels', {value: conversions[fromModel].channels});
|
|
1705
|
+
Object.defineProperty(convert[fromModel], 'labels', {value: conversions[fromModel].labels});
|
|
1642
1706
|
|
|
1643
|
-
|
|
1644
|
-
|
|
1707
|
+
var routes = route(fromModel);
|
|
1708
|
+
var routeModels = Object.keys(routes);
|
|
1645
1709
|
|
|
1646
|
-
|
|
1647
|
-
|
|
1710
|
+
routeModels.forEach(function (toModel) {
|
|
1711
|
+
var fn = routes[toModel];
|
|
1648
1712
|
|
|
1649
|
-
|
|
1650
|
-
|
|
1713
|
+
convert[fromModel][toModel] = wrapRounded(fn);
|
|
1714
|
+
convert[fromModel][toModel].raw = wrapRaw(fn);
|
|
1715
|
+
});
|
|
1651
1716
|
});
|
|
1652
|
-
});
|
|
1653
1717
|
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
var convert = colorConvert;
|
|
1718
|
+
colorConvert = convert;
|
|
1719
|
+
return colorConvert;
|
|
1720
|
+
}
|
|
1658
1721
|
|
|
1659
|
-
var
|
|
1722
|
+
var color;
|
|
1723
|
+
var hasRequiredColor;
|
|
1660
1724
|
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1725
|
+
function requireColor () {
|
|
1726
|
+
if (hasRequiredColor) return color;
|
|
1727
|
+
hasRequiredColor = 1;
|
|
1664
1728
|
|
|
1665
|
-
|
|
1666
|
-
|
|
1729
|
+
var colorString = requireColorString();
|
|
1730
|
+
var convert = requireColorConvert();
|
|
1667
1731
|
|
|
1668
|
-
|
|
1669
|
-
'hex'
|
|
1670
|
-
];
|
|
1732
|
+
var _slice = [].slice;
|
|
1671
1733
|
|
|
1672
|
-
var
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
});
|
|
1734
|
+
var skippedModels = [
|
|
1735
|
+
// to be honest, I don't really feel like keyword belongs in color convert, but eh.
|
|
1736
|
+
'keyword',
|
|
1676
1737
|
|
|
1677
|
-
|
|
1738
|
+
// gray conflicts with some method names, and has its own method defined.
|
|
1739
|
+
'gray',
|
|
1678
1740
|
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
}
|
|
1741
|
+
// shouldn't really be in color-convert either...
|
|
1742
|
+
'hex'
|
|
1743
|
+
];
|
|
1683
1744
|
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1745
|
+
var hashedModelKeys = {};
|
|
1746
|
+
Object.keys(convert).forEach(function (model) {
|
|
1747
|
+
hashedModelKeys[_slice.call(convert[model].labels).sort().join('')] = model;
|
|
1748
|
+
});
|
|
1687
1749
|
|
|
1688
|
-
|
|
1689
|
-
throw new Error('Unknown model: ' + model);
|
|
1690
|
-
}
|
|
1750
|
+
var limiters = {};
|
|
1691
1751
|
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
if (obj == null) { // eslint-disable-line no-eq-null,eqeqeq
|
|
1696
|
-
this.model = 'rgb';
|
|
1697
|
-
this.color = [0, 0, 0];
|
|
1698
|
-
this.valpha = 1;
|
|
1699
|
-
} else if (obj instanceof Color) {
|
|
1700
|
-
this.model = obj.model;
|
|
1701
|
-
this.color = obj.color.slice();
|
|
1702
|
-
this.valpha = obj.valpha;
|
|
1703
|
-
} else if (typeof obj === 'string') {
|
|
1704
|
-
var result = colorString.get(obj);
|
|
1705
|
-
if (result === null) {
|
|
1706
|
-
throw new Error('Unable to parse color from string: ' + obj);
|
|
1752
|
+
function Color(obj, model) {
|
|
1753
|
+
if (!(this instanceof Color)) {
|
|
1754
|
+
return new Color(obj, model);
|
|
1707
1755
|
}
|
|
1708
1756
|
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
this.color = result.value.slice(0, channels);
|
|
1712
|
-
this.valpha = typeof result.value[channels] === 'number' ? result.value[channels] : 1;
|
|
1713
|
-
} else if (obj.length) {
|
|
1714
|
-
this.model = model || 'rgb';
|
|
1715
|
-
channels = convert[this.model].channels;
|
|
1716
|
-
var newArr = _slice.call(obj, 0, channels);
|
|
1717
|
-
this.color = zeroArray(newArr, channels);
|
|
1718
|
-
this.valpha = typeof obj[channels] === 'number' ? obj[channels] : 1;
|
|
1719
|
-
} else if (typeof obj === 'number') {
|
|
1720
|
-
// this is always RGB - can be converted later on.
|
|
1721
|
-
obj &= 0xFFFFFF;
|
|
1722
|
-
this.model = 'rgb';
|
|
1723
|
-
this.color = [
|
|
1724
|
-
(obj >> 16) & 0xFF,
|
|
1725
|
-
(obj >> 8) & 0xFF,
|
|
1726
|
-
obj & 0xFF
|
|
1727
|
-
];
|
|
1728
|
-
this.valpha = 1;
|
|
1729
|
-
} else {
|
|
1730
|
-
this.valpha = 1;
|
|
1731
|
-
|
|
1732
|
-
var keys = Object.keys(obj);
|
|
1733
|
-
if ('alpha' in obj) {
|
|
1734
|
-
keys.splice(keys.indexOf('alpha'), 1);
|
|
1735
|
-
this.valpha = typeof obj.alpha === 'number' ? obj.alpha : 0;
|
|
1757
|
+
if (model && model in skippedModels) {
|
|
1758
|
+
model = null;
|
|
1736
1759
|
}
|
|
1737
1760
|
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
throw new Error('Unable to parse color from object: ' + JSON.stringify(obj));
|
|
1761
|
+
if (model && !(model in convert)) {
|
|
1762
|
+
throw new Error('Unknown model: ' + model);
|
|
1741
1763
|
}
|
|
1742
1764
|
|
|
1743
|
-
|
|
1765
|
+
var i;
|
|
1766
|
+
var channels;
|
|
1767
|
+
|
|
1768
|
+
if (obj == null) { // eslint-disable-line no-eq-null,eqeqeq
|
|
1769
|
+
this.model = 'rgb';
|
|
1770
|
+
this.color = [0, 0, 0];
|
|
1771
|
+
this.valpha = 1;
|
|
1772
|
+
} else if (obj instanceof Color) {
|
|
1773
|
+
this.model = obj.model;
|
|
1774
|
+
this.color = obj.color.slice();
|
|
1775
|
+
this.valpha = obj.valpha;
|
|
1776
|
+
} else if (typeof obj === 'string') {
|
|
1777
|
+
var result = colorString.get(obj);
|
|
1778
|
+
if (result === null) {
|
|
1779
|
+
throw new Error('Unable to parse color from string: ' + obj);
|
|
1780
|
+
}
|
|
1744
1781
|
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
}
|
|
1782
|
+
this.model = result.model;
|
|
1783
|
+
channels = convert[this.model].channels;
|
|
1784
|
+
this.color = result.value.slice(0, channels);
|
|
1785
|
+
this.valpha = typeof result.value[channels] === 'number' ? result.value[channels] : 1;
|
|
1786
|
+
} else if (obj.length) {
|
|
1787
|
+
this.model = model || 'rgb';
|
|
1788
|
+
channels = convert[this.model].channels;
|
|
1789
|
+
var newArr = _slice.call(obj, 0, channels);
|
|
1790
|
+
this.color = zeroArray(newArr, channels);
|
|
1791
|
+
this.valpha = typeof obj[channels] === 'number' ? obj[channels] : 1;
|
|
1792
|
+
} else if (typeof obj === 'number') {
|
|
1793
|
+
// this is always RGB - can be converted later on.
|
|
1794
|
+
obj &= 0xFFFFFF;
|
|
1795
|
+
this.model = 'rgb';
|
|
1796
|
+
this.color = [
|
|
1797
|
+
(obj >> 16) & 0xFF,
|
|
1798
|
+
(obj >> 8) & 0xFF,
|
|
1799
|
+
obj & 0xFF
|
|
1800
|
+
];
|
|
1801
|
+
this.valpha = 1;
|
|
1802
|
+
} else {
|
|
1803
|
+
this.valpha = 1;
|
|
1750
1804
|
|
|
1751
|
-
|
|
1752
|
-
|
|
1805
|
+
var keys = Object.keys(obj);
|
|
1806
|
+
if ('alpha' in obj) {
|
|
1807
|
+
keys.splice(keys.indexOf('alpha'), 1);
|
|
1808
|
+
this.valpha = typeof obj.alpha === 'number' ? obj.alpha : 0;
|
|
1809
|
+
}
|
|
1753
1810
|
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
for (i = 0; i < channels; i++) {
|
|
1758
|
-
var limit = limiters[this.model][i];
|
|
1759
|
-
if (limit) {
|
|
1760
|
-
this.color[i] = limit(this.color[i]);
|
|
1811
|
+
var hashedKeys = keys.sort().join('');
|
|
1812
|
+
if (!(hashedKeys in hashedModelKeys)) {
|
|
1813
|
+
throw new Error('Unable to parse color from object: ' + JSON.stringify(obj));
|
|
1761
1814
|
}
|
|
1762
|
-
}
|
|
1763
|
-
}
|
|
1764
1815
|
|
|
1765
|
-
|
|
1816
|
+
this.model = hashedModelKeys[hashedKeys];
|
|
1766
1817
|
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1818
|
+
var labels = convert[this.model].labels;
|
|
1819
|
+
var color = [];
|
|
1820
|
+
for (i = 0; i < labels.length; i++) {
|
|
1821
|
+
color.push(obj[labels[i]]);
|
|
1822
|
+
}
|
|
1771
1823
|
|
|
1772
|
-
|
|
1773
|
-
toString: function () {
|
|
1774
|
-
return this.string();
|
|
1775
|
-
},
|
|
1776
|
-
|
|
1777
|
-
toJSON: function () {
|
|
1778
|
-
return this[this.model]();
|
|
1779
|
-
},
|
|
1780
|
-
|
|
1781
|
-
string: function (places) {
|
|
1782
|
-
var self = this.model in colorString.to ? this : this.rgb();
|
|
1783
|
-
self = self.round(typeof places === 'number' ? places : 1);
|
|
1784
|
-
var args = self.valpha === 1 ? self.color : self.color.concat(this.valpha);
|
|
1785
|
-
return colorString.to[self.model](args);
|
|
1786
|
-
},
|
|
1787
|
-
|
|
1788
|
-
percentString: function (places) {
|
|
1789
|
-
var self = this.rgb().round(typeof places === 'number' ? places : 1);
|
|
1790
|
-
var args = self.valpha === 1 ? self.color : self.color.concat(this.valpha);
|
|
1791
|
-
return colorString.to.rgb.percent(args);
|
|
1792
|
-
},
|
|
1793
|
-
|
|
1794
|
-
array: function () {
|
|
1795
|
-
return this.valpha === 1 ? this.color.slice() : this.color.concat(this.valpha);
|
|
1796
|
-
},
|
|
1797
|
-
|
|
1798
|
-
object: function () {
|
|
1799
|
-
var result = {};
|
|
1800
|
-
var channels = convert[this.model].channels;
|
|
1801
|
-
var labels = convert[this.model].labels;
|
|
1802
|
-
|
|
1803
|
-
for (var i = 0; i < channels; i++) {
|
|
1804
|
-
result[labels[i]] = this.color[i];
|
|
1824
|
+
this.color = zeroArray(color);
|
|
1805
1825
|
}
|
|
1806
1826
|
|
|
1807
|
-
|
|
1808
|
-
|
|
1827
|
+
// perform limitations (clamping, etc.)
|
|
1828
|
+
if (limiters[this.model]) {
|
|
1829
|
+
channels = convert[this.model].channels;
|
|
1830
|
+
for (i = 0; i < channels; i++) {
|
|
1831
|
+
var limit = limiters[this.model][i];
|
|
1832
|
+
if (limit) {
|
|
1833
|
+
this.color[i] = limit(this.color[i]);
|
|
1834
|
+
}
|
|
1835
|
+
}
|
|
1809
1836
|
}
|
|
1810
1837
|
|
|
1811
|
-
|
|
1812
|
-
},
|
|
1838
|
+
this.valpha = Math.max(0, Math.min(1, this.valpha));
|
|
1813
1839
|
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
rgb[0] /= 255;
|
|
1817
|
-
rgb[1] /= 255;
|
|
1818
|
-
rgb[2] /= 255;
|
|
1819
|
-
|
|
1820
|
-
if (this.valpha !== 1) {
|
|
1821
|
-
rgb.push(this.valpha);
|
|
1840
|
+
if (Object.freeze) {
|
|
1841
|
+
Object.freeze(this);
|
|
1822
1842
|
}
|
|
1843
|
+
}
|
|
1823
1844
|
|
|
1824
|
-
|
|
1825
|
-
|
|
1845
|
+
Color.prototype = {
|
|
1846
|
+
toString: function () {
|
|
1847
|
+
return this.string();
|
|
1848
|
+
},
|
|
1849
|
+
|
|
1850
|
+
toJSON: function () {
|
|
1851
|
+
return this[this.model]();
|
|
1852
|
+
},
|
|
1853
|
+
|
|
1854
|
+
string: function (places) {
|
|
1855
|
+
var self = this.model in colorString.to ? this : this.rgb();
|
|
1856
|
+
self = self.round(typeof places === 'number' ? places : 1);
|
|
1857
|
+
var args = self.valpha === 1 ? self.color : self.color.concat(this.valpha);
|
|
1858
|
+
return colorString.to[self.model](args);
|
|
1859
|
+
},
|
|
1860
|
+
|
|
1861
|
+
percentString: function (places) {
|
|
1862
|
+
var self = this.rgb().round(typeof places === 'number' ? places : 1);
|
|
1863
|
+
var args = self.valpha === 1 ? self.color : self.color.concat(this.valpha);
|
|
1864
|
+
return colorString.to.rgb.percent(args);
|
|
1865
|
+
},
|
|
1866
|
+
|
|
1867
|
+
array: function () {
|
|
1868
|
+
return this.valpha === 1 ? this.color.slice() : this.color.concat(this.valpha);
|
|
1869
|
+
},
|
|
1870
|
+
|
|
1871
|
+
object: function () {
|
|
1872
|
+
var result = {};
|
|
1873
|
+
var channels = convert[this.model].channels;
|
|
1874
|
+
var labels = convert[this.model].labels;
|
|
1875
|
+
|
|
1876
|
+
for (var i = 0; i < channels; i++) {
|
|
1877
|
+
result[labels[i]] = this.color[i];
|
|
1878
|
+
}
|
|
1826
1879
|
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
rgb.g /= 255;
|
|
1831
|
-
rgb.b /= 255;
|
|
1880
|
+
if (this.valpha !== 1) {
|
|
1881
|
+
result.alpha = this.valpha;
|
|
1882
|
+
}
|
|
1832
1883
|
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
}
|
|
1884
|
+
return result;
|
|
1885
|
+
},
|
|
1836
1886
|
|
|
1837
|
-
|
|
1838
|
-
|
|
1887
|
+
unitArray: function () {
|
|
1888
|
+
var rgb = this.rgb().color;
|
|
1889
|
+
rgb[0] /= 255;
|
|
1890
|
+
rgb[1] /= 255;
|
|
1891
|
+
rgb[2] /= 255;
|
|
1839
1892
|
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
},
|
|
1893
|
+
if (this.valpha !== 1) {
|
|
1894
|
+
rgb.push(this.valpha);
|
|
1895
|
+
}
|
|
1844
1896
|
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
return new Color(this.color.concat(Math.max(0, Math.min(1, val))), this.model);
|
|
1848
|
-
}
|
|
1897
|
+
return rgb;
|
|
1898
|
+
},
|
|
1849
1899
|
|
|
1850
|
-
|
|
1851
|
-
|
|
1900
|
+
unitObject: function () {
|
|
1901
|
+
var rgb = this.rgb().object();
|
|
1902
|
+
rgb.r /= 255;
|
|
1903
|
+
rgb.g /= 255;
|
|
1904
|
+
rgb.b /= 255;
|
|
1852
1905
|
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
blue: getset('rgb', 2, maxfn(255)),
|
|
1906
|
+
if (this.valpha !== 1) {
|
|
1907
|
+
rgb.alpha = this.valpha;
|
|
1908
|
+
}
|
|
1857
1909
|
|
|
1858
|
-
|
|
1910
|
+
return rgb;
|
|
1911
|
+
},
|
|
1859
1912
|
|
|
1860
|
-
|
|
1861
|
-
|
|
1913
|
+
round: function (places) {
|
|
1914
|
+
places = Math.max(places || 0, 0);
|
|
1915
|
+
return new Color(this.color.map(roundToPlace(places)).concat(this.valpha), this.model);
|
|
1916
|
+
},
|
|
1862
1917
|
|
|
1863
|
-
|
|
1864
|
-
|
|
1918
|
+
alpha: function (val) {
|
|
1919
|
+
if (arguments.length) {
|
|
1920
|
+
return new Color(this.color.concat(Math.max(0, Math.min(1, val))), this.model);
|
|
1921
|
+
}
|
|
1865
1922
|
|
|
1866
|
-
|
|
1867
|
-
|
|
1923
|
+
return this.valpha;
|
|
1924
|
+
},
|
|
1868
1925
|
|
|
1869
|
-
|
|
1870
|
-
|
|
1926
|
+
// rgb
|
|
1927
|
+
red: getset('rgb', 0, maxfn(255)),
|
|
1928
|
+
green: getset('rgb', 1, maxfn(255)),
|
|
1929
|
+
blue: getset('rgb', 2, maxfn(255)),
|
|
1871
1930
|
|
|
1872
|
-
|
|
1873
|
-
magenta: getset('cmyk', 1, maxfn(100)),
|
|
1874
|
-
yellow: getset('cmyk', 2, maxfn(100)),
|
|
1875
|
-
black: getset('cmyk', 3, maxfn(100)),
|
|
1931
|
+
hue: getset(['hsl', 'hsv', 'hsl', 'hwb', 'hcg'], 0, function (val) { return ((val % 360) + 360) % 360; }), // eslint-disable-line brace-style
|
|
1876
1932
|
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
z: getset('xyz', 2, maxfn(100)),
|
|
1933
|
+
saturationl: getset('hsl', 1, maxfn(100)),
|
|
1934
|
+
lightness: getset('hsl', 2, maxfn(100)),
|
|
1880
1935
|
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
b: getset('lab', 2),
|
|
1936
|
+
saturationv: getset('hsv', 1, maxfn(100)),
|
|
1937
|
+
value: getset('hsv', 2, maxfn(100)),
|
|
1884
1938
|
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
return new Color(val);
|
|
1888
|
-
}
|
|
1939
|
+
chroma: getset('hcg', 1, maxfn(100)),
|
|
1940
|
+
gray: getset('hcg', 2, maxfn(100)),
|
|
1889
1941
|
|
|
1890
|
-
|
|
1891
|
-
|
|
1942
|
+
white: getset('hwb', 1, maxfn(100)),
|
|
1943
|
+
wblack: getset('hwb', 2, maxfn(100)),
|
|
1892
1944
|
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1945
|
+
cyan: getset('cmyk', 0, maxfn(100)),
|
|
1946
|
+
magenta: getset('cmyk', 1, maxfn(100)),
|
|
1947
|
+
yellow: getset('cmyk', 2, maxfn(100)),
|
|
1948
|
+
black: getset('cmyk', 3, maxfn(100)),
|
|
1897
1949
|
|
|
1898
|
-
|
|
1899
|
-
|
|
1950
|
+
x: getset('xyz', 0, maxfn(100)),
|
|
1951
|
+
y: getset('xyz', 1, maxfn(100)),
|
|
1952
|
+
z: getset('xyz', 2, maxfn(100)),
|
|
1900
1953
|
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
},
|
|
1954
|
+
l: getset('lab', 0, maxfn(100)),
|
|
1955
|
+
a: getset('lab', 1),
|
|
1956
|
+
b: getset('lab', 2),
|
|
1905
1957
|
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1958
|
+
keyword: function (val) {
|
|
1959
|
+
if (arguments.length) {
|
|
1960
|
+
return new Color(val);
|
|
1961
|
+
}
|
|
1909
1962
|
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
var chan = rgb[i] / 255;
|
|
1913
|
-
lum[i] = (chan <= 0.03928) ? chan / 12.92 : Math.pow(((chan + 0.055) / 1.055), 2.4);
|
|
1914
|
-
}
|
|
1963
|
+
return convert[this.model].keyword(this.color);
|
|
1964
|
+
},
|
|
1915
1965
|
|
|
1916
|
-
|
|
1917
|
-
|
|
1966
|
+
hex: function (val) {
|
|
1967
|
+
if (arguments.length) {
|
|
1968
|
+
return new Color(val);
|
|
1969
|
+
}
|
|
1918
1970
|
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
var lum1 = this.luminosity();
|
|
1922
|
-
var lum2 = color2.luminosity();
|
|
1971
|
+
return colorString.to.hex(this.rgb().round().color);
|
|
1972
|
+
},
|
|
1923
1973
|
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1974
|
+
rgbNumber: function () {
|
|
1975
|
+
var rgb = this.rgb().color;
|
|
1976
|
+
return ((rgb[0] & 0xFF) << 16) | ((rgb[1] & 0xFF) << 8) | (rgb[2] & 0xFF);
|
|
1977
|
+
},
|
|
1927
1978
|
|
|
1928
|
-
|
|
1929
|
-
|
|
1979
|
+
luminosity: function () {
|
|
1980
|
+
// http://www.w3.org/TR/WCAG20/#relativeluminancedef
|
|
1981
|
+
var rgb = this.rgb().color;
|
|
1930
1982
|
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1983
|
+
var lum = [];
|
|
1984
|
+
for (var i = 0; i < rgb.length; i++) {
|
|
1985
|
+
var chan = rgb[i] / 255;
|
|
1986
|
+
lum[i] = (chan <= 0.03928) ? chan / 12.92 : Math.pow(((chan + 0.055) / 1.055), 2.4);
|
|
1987
|
+
}
|
|
1936
1988
|
|
|
1937
|
-
|
|
1938
|
-
|
|
1989
|
+
return 0.2126 * lum[0] + 0.7152 * lum[1] + 0.0722 * lum[2];
|
|
1990
|
+
},
|
|
1939
1991
|
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
return yiq < 128;
|
|
1945
|
-
},
|
|
1992
|
+
contrast: function (color2) {
|
|
1993
|
+
// http://www.w3.org/TR/WCAG20/#contrast-ratiodef
|
|
1994
|
+
var lum1 = this.luminosity();
|
|
1995
|
+
var lum2 = color2.luminosity();
|
|
1946
1996
|
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1997
|
+
if (lum1 > lum2) {
|
|
1998
|
+
return (lum1 + 0.05) / (lum2 + 0.05);
|
|
1999
|
+
}
|
|
1950
2000
|
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
for (var i = 0; i < 3; i++) {
|
|
1954
|
-
rgb.color[i] = 255 - rgb.color[i];
|
|
1955
|
-
}
|
|
1956
|
-
return rgb;
|
|
1957
|
-
},
|
|
1958
|
-
|
|
1959
|
-
lighten: function (ratio) {
|
|
1960
|
-
var hsl = this.hsl();
|
|
1961
|
-
hsl.color[2] += hsl.color[2] * ratio;
|
|
1962
|
-
return hsl;
|
|
1963
|
-
},
|
|
1964
|
-
|
|
1965
|
-
darken: function (ratio) {
|
|
1966
|
-
var hsl = this.hsl();
|
|
1967
|
-
hsl.color[2] -= hsl.color[2] * ratio;
|
|
1968
|
-
return hsl;
|
|
1969
|
-
},
|
|
1970
|
-
|
|
1971
|
-
saturate: function (ratio) {
|
|
1972
|
-
var hsl = this.hsl();
|
|
1973
|
-
hsl.color[1] += hsl.color[1] * ratio;
|
|
1974
|
-
return hsl;
|
|
1975
|
-
},
|
|
1976
|
-
|
|
1977
|
-
desaturate: function (ratio) {
|
|
1978
|
-
var hsl = this.hsl();
|
|
1979
|
-
hsl.color[1] -= hsl.color[1] * ratio;
|
|
1980
|
-
return hsl;
|
|
1981
|
-
},
|
|
1982
|
-
|
|
1983
|
-
whiten: function (ratio) {
|
|
1984
|
-
var hwb = this.hwb();
|
|
1985
|
-
hwb.color[1] += hwb.color[1] * ratio;
|
|
1986
|
-
return hwb;
|
|
1987
|
-
},
|
|
1988
|
-
|
|
1989
|
-
blacken: function (ratio) {
|
|
1990
|
-
var hwb = this.hwb();
|
|
1991
|
-
hwb.color[2] += hwb.color[2] * ratio;
|
|
1992
|
-
return hwb;
|
|
1993
|
-
},
|
|
1994
|
-
|
|
1995
|
-
grayscale: function () {
|
|
1996
|
-
// http://en.wikipedia.org/wiki/Grayscale#Converting_color_to_grayscale
|
|
1997
|
-
var rgb = this.rgb().color;
|
|
1998
|
-
var val = rgb[0] * 0.3 + rgb[1] * 0.59 + rgb[2] * 0.11;
|
|
1999
|
-
return Color.rgb(val, val, val);
|
|
2000
|
-
},
|
|
2001
|
-
|
|
2002
|
-
fade: function (ratio) {
|
|
2003
|
-
return this.alpha(this.valpha - (this.valpha * ratio));
|
|
2004
|
-
},
|
|
2005
|
-
|
|
2006
|
-
opaquer: function (ratio) {
|
|
2007
|
-
return this.alpha(this.valpha + (this.valpha * ratio));
|
|
2008
|
-
},
|
|
2009
|
-
|
|
2010
|
-
rotate: function (degrees) {
|
|
2011
|
-
var hsl = this.hsl();
|
|
2012
|
-
var hue = hsl.color[0];
|
|
2013
|
-
hue = (hue + degrees) % 360;
|
|
2014
|
-
hue = hue < 0 ? 360 + hue : hue;
|
|
2015
|
-
hsl.color[0] = hue;
|
|
2016
|
-
return hsl;
|
|
2017
|
-
},
|
|
2018
|
-
|
|
2019
|
-
mix: function (mixinColor, weight) {
|
|
2020
|
-
// ported from sass implementation in C
|
|
2021
|
-
// https://github.com/sass/libsass/blob/0e6b4a2850092356aa3ece07c6b249f0221caced/functions.cpp#L209
|
|
2022
|
-
if (!mixinColor || !mixinColor.rgb) {
|
|
2023
|
-
throw new Error('Argument to "mix" was not a Color instance, but rather an instance of ' + typeof mixinColor);
|
|
2024
|
-
}
|
|
2025
|
-
var color1 = mixinColor.rgb();
|
|
2026
|
-
var color2 = this.rgb();
|
|
2027
|
-
var p = weight === undefined ? 0.5 : weight;
|
|
2001
|
+
return (lum2 + 0.05) / (lum1 + 0.05);
|
|
2002
|
+
},
|
|
2028
2003
|
|
|
2029
|
-
|
|
2030
|
-
|
|
2004
|
+
level: function (color2) {
|
|
2005
|
+
var contrastRatio = this.contrast(color2);
|
|
2006
|
+
if (contrastRatio >= 7.1) {
|
|
2007
|
+
return 'AAA';
|
|
2008
|
+
}
|
|
2031
2009
|
|
|
2032
|
-
|
|
2033
|
-
|
|
2010
|
+
return (contrastRatio >= 4.5) ? 'AA' : '';
|
|
2011
|
+
},
|
|
2034
2012
|
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
};
|
|
2013
|
+
isDark: function () {
|
|
2014
|
+
// YIQ equation from http://24ways.org/2010/calculating-color-contrast
|
|
2015
|
+
var rgb = this.rgb().color;
|
|
2016
|
+
var yiq = (rgb[0] * 299 + rgb[1] * 587 + rgb[2] * 114) / 1000;
|
|
2017
|
+
return yiq < 128;
|
|
2018
|
+
},
|
|
2042
2019
|
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2020
|
+
isLight: function () {
|
|
2021
|
+
return !this.isDark();
|
|
2022
|
+
},
|
|
2023
|
+
|
|
2024
|
+
negate: function () {
|
|
2025
|
+
var rgb = this.rgb();
|
|
2026
|
+
for (var i = 0; i < 3; i++) {
|
|
2027
|
+
rgb.color[i] = 255 - rgb.color[i];
|
|
2028
|
+
}
|
|
2029
|
+
return rgb;
|
|
2030
|
+
},
|
|
2031
|
+
|
|
2032
|
+
lighten: function (ratio) {
|
|
2033
|
+
var hsl = this.hsl();
|
|
2034
|
+
hsl.color[2] += hsl.color[2] * ratio;
|
|
2035
|
+
return hsl;
|
|
2036
|
+
},
|
|
2037
|
+
|
|
2038
|
+
darken: function (ratio) {
|
|
2039
|
+
var hsl = this.hsl();
|
|
2040
|
+
hsl.color[2] -= hsl.color[2] * ratio;
|
|
2041
|
+
return hsl;
|
|
2042
|
+
},
|
|
2043
|
+
|
|
2044
|
+
saturate: function (ratio) {
|
|
2045
|
+
var hsl = this.hsl();
|
|
2046
|
+
hsl.color[1] += hsl.color[1] * ratio;
|
|
2047
|
+
return hsl;
|
|
2048
|
+
},
|
|
2049
|
+
|
|
2050
|
+
desaturate: function (ratio) {
|
|
2051
|
+
var hsl = this.hsl();
|
|
2052
|
+
hsl.color[1] -= hsl.color[1] * ratio;
|
|
2053
|
+
return hsl;
|
|
2054
|
+
},
|
|
2055
|
+
|
|
2056
|
+
whiten: function (ratio) {
|
|
2057
|
+
var hwb = this.hwb();
|
|
2058
|
+
hwb.color[1] += hwb.color[1] * ratio;
|
|
2059
|
+
return hwb;
|
|
2060
|
+
},
|
|
2061
|
+
|
|
2062
|
+
blacken: function (ratio) {
|
|
2063
|
+
var hwb = this.hwb();
|
|
2064
|
+
hwb.color[2] += hwb.color[2] * ratio;
|
|
2065
|
+
return hwb;
|
|
2066
|
+
},
|
|
2067
|
+
|
|
2068
|
+
grayscale: function () {
|
|
2069
|
+
// http://en.wikipedia.org/wiki/Grayscale#Converting_color_to_grayscale
|
|
2070
|
+
var rgb = this.rgb().color;
|
|
2071
|
+
var val = rgb[0] * 0.3 + rgb[1] * 0.59 + rgb[2] * 0.11;
|
|
2072
|
+
return Color.rgb(val, val, val);
|
|
2073
|
+
},
|
|
2074
|
+
|
|
2075
|
+
fade: function (ratio) {
|
|
2076
|
+
return this.alpha(this.valpha - (this.valpha * ratio));
|
|
2077
|
+
},
|
|
2078
|
+
|
|
2079
|
+
opaquer: function (ratio) {
|
|
2080
|
+
return this.alpha(this.valpha + (this.valpha * ratio));
|
|
2081
|
+
},
|
|
2082
|
+
|
|
2083
|
+
rotate: function (degrees) {
|
|
2084
|
+
var hsl = this.hsl();
|
|
2085
|
+
var hue = hsl.color[0];
|
|
2086
|
+
hue = (hue + degrees) % 360;
|
|
2087
|
+
hue = hue < 0 ? 360 + hue : hue;
|
|
2088
|
+
hsl.color[0] = hue;
|
|
2089
|
+
return hsl;
|
|
2090
|
+
},
|
|
2091
|
+
|
|
2092
|
+
mix: function (mixinColor, weight) {
|
|
2093
|
+
// ported from sass implementation in C
|
|
2094
|
+
// https://github.com/sass/libsass/blob/0e6b4a2850092356aa3ece07c6b249f0221caced/functions.cpp#L209
|
|
2095
|
+
if (!mixinColor || !mixinColor.rgb) {
|
|
2096
|
+
throw new Error('Argument to "mix" was not a Color instance, but rather an instance of ' + typeof mixinColor);
|
|
2097
|
+
}
|
|
2098
|
+
var color1 = mixinColor.rgb();
|
|
2099
|
+
var color2 = this.rgb();
|
|
2100
|
+
var p = weight === undefined ? 0.5 : weight;
|
|
2048
2101
|
|
|
2049
|
-
|
|
2102
|
+
var w = 2 * p - 1;
|
|
2103
|
+
var a = color1.alpha() - color2.alpha();
|
|
2050
2104
|
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
if (this.model === model) {
|
|
2054
|
-
return new Color(this);
|
|
2055
|
-
}
|
|
2105
|
+
var w1 = (((w * a === -1) ? w : (w + a) / (1 + w * a)) + 1) / 2.0;
|
|
2106
|
+
var w2 = 1 - w1;
|
|
2056
2107
|
|
|
2057
|
-
|
|
2058
|
-
|
|
2108
|
+
return Color.rgb(
|
|
2109
|
+
w1 * color1.red() + w2 * color2.red(),
|
|
2110
|
+
w1 * color1.green() + w2 * color2.green(),
|
|
2111
|
+
w1 * color1.blue() + w2 * color2.blue(),
|
|
2112
|
+
color1.alpha() * p + color2.alpha() * (1 - p));
|
|
2059
2113
|
}
|
|
2060
|
-
|
|
2061
|
-
var newAlpha = typeof arguments[channels] === 'number' ? channels : this.valpha;
|
|
2062
|
-
return new Color(assertArray(convert[this.model][model].raw(this.color)).concat(newAlpha), model);
|
|
2063
2114
|
};
|
|
2064
2115
|
|
|
2065
|
-
//
|
|
2066
|
-
|
|
2067
|
-
if (
|
|
2068
|
-
|
|
2116
|
+
// model conversion methods and static constructors
|
|
2117
|
+
Object.keys(convert).forEach(function (model) {
|
|
2118
|
+
if (skippedModels.indexOf(model) !== -1) {
|
|
2119
|
+
return;
|
|
2069
2120
|
}
|
|
2070
|
-
return new Color(color, model);
|
|
2071
|
-
};
|
|
2072
|
-
});
|
|
2073
2121
|
|
|
2074
|
-
|
|
2075
|
-
return Number(num.toFixed(places));
|
|
2076
|
-
}
|
|
2122
|
+
var channels = convert[model].channels;
|
|
2077
2123
|
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
}
|
|
2124
|
+
// conversion methods
|
|
2125
|
+
Color.prototype[model] = function () {
|
|
2126
|
+
if (this.model === model) {
|
|
2127
|
+
return new Color(this);
|
|
2128
|
+
}
|
|
2083
2129
|
|
|
2084
|
-
|
|
2085
|
-
|
|
2130
|
+
if (arguments.length) {
|
|
2131
|
+
return new Color(arguments, model);
|
|
2132
|
+
}
|
|
2086
2133
|
|
|
2087
|
-
|
|
2088
|
-
|
|
2134
|
+
var newAlpha = typeof arguments[channels] === 'number' ? channels : this.valpha;
|
|
2135
|
+
return new Color(assertArray(convert[this.model][model].raw(this.color)).concat(newAlpha), model);
|
|
2136
|
+
};
|
|
2137
|
+
|
|
2138
|
+
// 'static' construction methods
|
|
2139
|
+
Color[model] = function (color) {
|
|
2140
|
+
if (typeof color === 'number') {
|
|
2141
|
+
color = zeroArray(_slice.call(arguments), channels);
|
|
2142
|
+
}
|
|
2143
|
+
return new Color(color, model);
|
|
2144
|
+
};
|
|
2089
2145
|
});
|
|
2090
2146
|
|
|
2091
|
-
|
|
2147
|
+
function roundTo(num, places) {
|
|
2148
|
+
return Number(num.toFixed(places));
|
|
2149
|
+
}
|
|
2150
|
+
|
|
2151
|
+
function roundToPlace(places) {
|
|
2152
|
+
return function (num) {
|
|
2153
|
+
return roundTo(num, places);
|
|
2154
|
+
};
|
|
2155
|
+
}
|
|
2156
|
+
|
|
2157
|
+
function getset(model, channel, modifier) {
|
|
2158
|
+
model = Array.isArray(model) ? model : [model];
|
|
2159
|
+
|
|
2160
|
+
model.forEach(function (m) {
|
|
2161
|
+
(limiters[m] || (limiters[m] = []))[channel] = modifier;
|
|
2162
|
+
});
|
|
2092
2163
|
|
|
2093
|
-
|
|
2094
|
-
var result;
|
|
2164
|
+
model = model[0];
|
|
2095
2165
|
|
|
2096
|
-
|
|
2166
|
+
return function (val) {
|
|
2167
|
+
var result;
|
|
2168
|
+
|
|
2169
|
+
if (arguments.length) {
|
|
2170
|
+
if (modifier) {
|
|
2171
|
+
val = modifier(val);
|
|
2172
|
+
}
|
|
2173
|
+
|
|
2174
|
+
result = this[model]();
|
|
2175
|
+
result.color[channel] = val;
|
|
2176
|
+
return result;
|
|
2177
|
+
}
|
|
2178
|
+
|
|
2179
|
+
result = this[model]().color[channel];
|
|
2097
2180
|
if (modifier) {
|
|
2098
|
-
|
|
2181
|
+
result = modifier(result);
|
|
2099
2182
|
}
|
|
2100
2183
|
|
|
2101
|
-
result = this[model]();
|
|
2102
|
-
result.color[channel] = val;
|
|
2103
2184
|
return result;
|
|
2104
|
-
}
|
|
2105
|
-
|
|
2106
|
-
result = this[model]().color[channel];
|
|
2107
|
-
if (modifier) {
|
|
2108
|
-
result = modifier(result);
|
|
2109
|
-
}
|
|
2110
|
-
|
|
2111
|
-
return result;
|
|
2112
|
-
};
|
|
2113
|
-
}
|
|
2185
|
+
};
|
|
2186
|
+
}
|
|
2114
2187
|
|
|
2115
|
-
function maxfn(max) {
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
}
|
|
2188
|
+
function maxfn(max) {
|
|
2189
|
+
return function (v) {
|
|
2190
|
+
return Math.max(0, Math.min(max, v));
|
|
2191
|
+
};
|
|
2192
|
+
}
|
|
2120
2193
|
|
|
2121
|
-
function assertArray(val) {
|
|
2122
|
-
|
|
2123
|
-
}
|
|
2194
|
+
function assertArray(val) {
|
|
2195
|
+
return Array.isArray(val) ? val : [val];
|
|
2196
|
+
}
|
|
2124
2197
|
|
|
2125
|
-
function zeroArray(arr, length) {
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2198
|
+
function zeroArray(arr, length) {
|
|
2199
|
+
for (var i = 0; i < length; i++) {
|
|
2200
|
+
if (typeof arr[i] !== 'number') {
|
|
2201
|
+
arr[i] = 0;
|
|
2202
|
+
}
|
|
2129
2203
|
}
|
|
2204
|
+
|
|
2205
|
+
return arr;
|
|
2130
2206
|
}
|
|
2131
2207
|
|
|
2132
|
-
|
|
2208
|
+
color = Color;
|
|
2209
|
+
return color;
|
|
2133
2210
|
}
|
|
2134
2211
|
|
|
2135
|
-
var
|
|
2212
|
+
var colorExports = requireColor();
|
|
2213
|
+
var Color = /*@__PURE__*/getDefaultExportFromCjs(colorExports);
|
|
2214
|
+
|
|
2215
|
+
var colorStringExports = requireColorString();
|
|
2216
|
+
var colorString = /*@__PURE__*/getDefaultExportFromCjs(colorStringExports);
|
|
2136
2217
|
|
|
2137
|
-
|
|
2138
|
-
|
|
2218
|
+
var lerp_1;
|
|
2219
|
+
var hasRequiredLerp;
|
|
2220
|
+
|
|
2221
|
+
function requireLerp () {
|
|
2222
|
+
if (hasRequiredLerp) return lerp_1;
|
|
2223
|
+
hasRequiredLerp = 1;
|
|
2224
|
+
function lerp(v0, v1, t) {
|
|
2225
|
+
return v0*(1-t)+v1*t
|
|
2226
|
+
}
|
|
2227
|
+
lerp_1 = lerp;
|
|
2228
|
+
return lerp_1;
|
|
2139
2229
|
}
|
|
2140
|
-
|
|
2230
|
+
|
|
2231
|
+
var lerpExports = requireLerp();
|
|
2232
|
+
var lerp = /*@__PURE__*/getDefaultExportFromCjs(lerpExports);
|
|
2141
2233
|
|
|
2142
2234
|
const ColorPlugin = {
|
|
2143
2235
|
name: 'color',
|
|
@@ -2147,7 +2239,7 @@ const ColorPlugin = {
|
|
|
2147
2239
|
(startValue.indexOf('rgb') >= 0 ||
|
|
2148
2240
|
startValue.indexOf('#') >= 0 ||
|
|
2149
2241
|
startValue.indexOf('hsl') >= 0 ||
|
|
2150
|
-
colorString
|
|
2242
|
+
colorString.get.rgb(startValue))); // true
|
|
2151
2243
|
},
|
|
2152
2244
|
initialize(startValue, destValue) {
|
|
2153
2245
|
return {
|
|
@@ -2155,19 +2247,19 @@ const ColorPlugin = {
|
|
|
2155
2247
|
format: (startValue.indexOf('rgba') >= 0 && 'rgba') ||
|
|
2156
2248
|
(startValue.indexOf('rgb') >= 0 && 'rgb') ||
|
|
2157
2249
|
(startValue.indexOf('#') >= 0 && 'hex') ||
|
|
2158
|
-
|
|
2250
|
+
Color(startValue).model,
|
|
2159
2251
|
},
|
|
2160
|
-
startValue:
|
|
2161
|
-
destValue:
|
|
2252
|
+
startValue: Color(startValue).rgb(),
|
|
2253
|
+
destValue: Color(destValue).rgb(),
|
|
2162
2254
|
};
|
|
2163
2255
|
},
|
|
2164
2256
|
interpolate(startValue, destValue, progress, data) {
|
|
2165
|
-
const r =
|
|
2166
|
-
const g =
|
|
2167
|
-
const b =
|
|
2168
|
-
const a =
|
|
2169
|
-
const color
|
|
2170
|
-
return typeof color
|
|
2257
|
+
const r = lerp(startValue.color[0], destValue.color[0], progress);
|
|
2258
|
+
const g = lerp(startValue.color[1], destValue.color[1], progress);
|
|
2259
|
+
const b = lerp(startValue.color[2], destValue.color[2], progress);
|
|
2260
|
+
const a = lerp(startValue.valpha, destValue.valpha, progress);
|
|
2261
|
+
const color = Color.rgb(r, g, b, a)[data.format === 'rgba' ? 'rgb' : data.format]();
|
|
2262
|
+
return typeof color === 'string' ? color : color.string();
|
|
2171
2263
|
},
|
|
2172
2264
|
};
|
|
2173
2265
|
|
|
@@ -2475,7 +2567,7 @@ const actions = {
|
|
|
2475
2567
|
};
|
|
2476
2568
|
|
|
2477
2569
|
// WARNING: generated file...
|
|
2478
|
-
const TW_VERSION = '4.0.
|
|
2570
|
+
const TW_VERSION = '4.0.14';
|
|
2479
2571
|
|
|
2480
2572
|
const ColorPicker = props => {
|
|
2481
2573
|
const { actions, state } = props;
|
|
@@ -2566,15 +2658,24 @@ const DataValues = props => {
|
|
|
2566
2658
|
h(TwLabel, null)));
|
|
2567
2659
|
};
|
|
2568
2660
|
|
|
2569
|
-
var between = {exports: {}};
|
|
2661
|
+
var between$1 = {exports: {}};
|
|
2570
2662
|
|
|
2571
2663
|
/* Between.js v0.1.2-fix.2 */
|
|
2664
|
+
var between = between$1.exports;
|
|
2572
2665
|
|
|
2573
|
-
|
|
2574
|
-
!function(t,n){module.exports=n();}(commonjsGlobal,function(){function O(t){return (O="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function r(t,n){for(var e=0;e<n.length;e++){var r=n[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r);}}function n(t,n,e){return n&&r(t.prototype,n),e&&r(t,e),t}function M(t,n,e){return n in t?Object.defineProperty(t,n,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[n]=e,t}function I(t){return (I=Object.getPrototypeOf||function(t){return t.__proto__})(t)}function o(t,n){return (o=Object.setPrototypeOf||function(t,n){return t.__proto__=n,t})(t,n)}function u(t,n,e){return (u="undefined"!=typeof Reflect&&Reflect.construct?Reflect.construct:function(t,n,e){var r=[null];r.push.apply(r,n);var u=new(t.bind.apply(t,r));return e&&o(u,e.prototype),u}).apply(null,arguments)}function _(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}var t=function(o){var a={},i=[];(o=o||this).on=function(t,n,e){return (a[t]=a[t]||[]).push([n,e]),o},o.off=function(t,n){t||(a={});for(var e=a[t]||i,r=e.length=n?e.length:0;r--;)n==e[r][0]&&e.splice(r,1);return o},o.emit=function(t){for(var n,e=a[t]||i,r=0<e.length?e.slice(0,e.length):e,u=0;n=r[u++];)n[0].apply(n[1],i.slice.call(arguments,1));return o};};var V=function(t,n,e){return t*(1-e)+n*e},e="undefined"!=typeof window?window:"undefined"!=typeof commonjsGlobal?commonjsGlobal:"undefined"!=typeof self?self:{};function a(t,n){return t(n={exports:{}},n.exports),n.exports}for(var i=a(function(t){var n=t.exports={Linear:{None:function(t){return t}},Quadratic:{In:function(t){return t*t},Out:function(t){return t*(2-t)},InOut:function(t){return (t*=2)<1?.5*t*t:-.5*(--t*(t-2)-1)}},Cubic:{In:function(t){return t*t*t},Out:function(t){return --t*t*t+1},InOut:function(t){return (t*=2)<1?.5*t*t*t:.5*((t-=2)*t*t+2)}},Quartic:{In:function(t){return t*t*t*t},Out:function(t){return 1- --t*t*t*t},InOut:function(t){return (t*=2)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2)}},Quintic:{In:function(t){return t*t*t*t*t},Out:function(t){return --t*t*t*t*t+1},InOut:function(t){return (t*=2)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2)}},Sinusoidal:{In:function(t){return 1-Math.cos(t*Math.PI/2)},Out:function(t){return Math.sin(t*Math.PI/2)},InOut:function(t){return .5*(1-Math.cos(Math.PI*t))}},Exponential:{In:function(t){return 0===t?0:Math.pow(1024,t-1)},Out:function(t){return 1===t?1:1-Math.pow(2,-10*t)},InOut:function(t){return 0===t?0:1===t?1:(t*=2)<1?.5*Math.pow(1024,t-1):.5*(2-Math.pow(2,-10*(t-1)))}},Circular:{In:function(t){return 1-Math.sqrt(1-t*t)},Out:function(t){return Math.sqrt(1- --t*t)},InOut:function(t){return (t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)}},Elastic:{In:function(t){var n,e=.1;return 0===t?0:1===t?1:(!e||e<1?(e=1,n=.1):n=.4*Math.asin(1/e)/(2*Math.PI),-e*Math.pow(2,10*(t-=1))*Math.sin((t-n)*(2*Math.PI)/.4))},Out:function(t){var n,e=.1;return 0===t?0:1===t?1:(!e||e<1?(e=1,n=.1):n=.4*Math.asin(1/e)/(2*Math.PI),e*Math.pow(2,-10*t)*Math.sin((t-n)*(2*Math.PI)/.4)+1)},InOut:function(t){var n,e=.1;return 0===t?0:1===t?1:(!e||e<1?(e=1,n=.1):n=.4*Math.asin(1/e)/(2*Math.PI),(t*=2)<1?e*Math.pow(2,10*(t-=1))*Math.sin((t-n)*(2*Math.PI)/.4)*-.5:e*Math.pow(2,-10*(t-=1))*Math.sin((t-n)*(2*Math.PI)/.4)*.5+1)}},Back:{In:function(t){return t*t*(2.70158*t-1.70158)},Out:function(t){return --t*t*(2.70158*t+1.70158)+1},InOut:function(t){var n=2.5949095;return (t*=2)<1?t*t*((n+1)*t-n)*.5:.5*((t-=2)*t*((n+1)*t+n)+2)}},Bounce:{In:function(t){return 1-n.Bounce.Out(1-t)},Out:function(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375},InOut:function(t){return t<.5?.5*n.Bounce.In(2*t):.5*n.Bounce.Out(2*t-1)+.5}}};}),c=(a(function(a){(function(){var t,n,e,r,u,o;"undefined"!=typeof performance&&null!==performance&&performance.now?a.exports=function(){return performance.now()}:"undefined"!=typeof process&&null!==process&&process.hrtime?(a.exports=function(){return (t()-u)/1e6},n=process.hrtime,r=(t=function(){var t;return 1e9*(t=n())[0]+t[1]})(),o=1e9*process.uptime(),u=r-o):Date.now?(a.exports=function(){return Date.now()-e},e=Date.now()):(a.exports=function(){return (new Date).getTime()-e},e=(new Date).getTime());}).call(e);})),l="undefined"==typeof window?e:window,f=["moz","webkit"],s="AnimationFrame",p=l["request"+s],h=l["cancel"+s]||l["cancelRequest"+s],m=0;!p&&m<f.length;m++)p=l[f[m]+"Request"+s],h=l[f[m]+"Cancel"+s]||l[f[m]+"CancelRequest"+s];if(!p||!h){var d=0,y=0,v=[];p=function(t){if(0===v.length){var n=c(),e=Math.max(0,1e3/60-(n-d));d=e+n,setTimeout(function(){for(var t=v.slice(0),n=v.length=0;n<t.length;n++)if(!t[n].cancelled)try{t[n].callback(d);}catch(t){setTimeout(function(){throw t},0);}},Math.round(e));}return v.push({handle:++y,callback:t,cancelled:!1}),y},h=function(t){for(var n=0;n<v.length;n++)v[n].handle===t&&(v[n].cancelled=!0);};}var b=function(t){return p.call(l,t)};b.cancel=function(){h.apply(l,arguments);},b.polyfill=function(t){t||(t=l),t.requestAnimationFrame=p,t.cancelAnimationFrame=h;};var w,k,P=[],T=Symbol("type"),j=Symbol("start_time"),x=Symbol("completed"),D=Symbol("paused"),g=requestAnimationFrame||b,A=Date.now();!function t(){g(t),w=Date.now(),k=w-A;for(var n=0;n<P.length;n++)P[n][x]||P[n](k,Date.now()-P[n][j]);A=w;}();var E=function(t){function g(e,t){var n,r,u,o;!function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}(this,g),u=this,o=I(g).call(this),M(_(_(r=!o||"object"!=typeof o&&"function"!=typeof o?_(u):o)),"update",function(){var e=_(_(r))._updateValue;return function(t,n){r[x]||r[D]||(0===r.localTime&&r.emit("start",r.value,_(_(r))),e(r.ease(r.loopFunction.progress(Math.min(1,(n||r.localTime)/r.duration)))),r.emit("update",r.value,_(_(r)),t),r.localTime>=r.duration&&r.loopFunction.complete(function(){r[x]=!0,r.emit("complete",r.value,_(_(r)));}),r.localTime+=t);}});var a=r.plugin=Object.values(g._plugins).reduce(function(t,n){return t||n&&n.test&&n.test(e)&&n},!1),i=a&&a.name||("object"===O(e)?Array.isArray(e)?"array":"object":"number");if(a){var c=a.initialize(e,t);e=c.startValue,t=c.destValue,r.data=c.data;}switch(Object.assign(_(_(r)),(M(n={duration:1e3,localTime:0,startValue:e,destValue:t,loopMode:"once",loopFunction:g.DEFAULT_LOOP,ease:function(t){return t},value:"array"===i?[].concat(e):"object"===i?Object.assign({},e):e},x,!1),M(n,T,i),M(n,j,Date.now()),M(n,D,!1),n)),r[T]){case"number":r._updateValue=function(t){r.value=V(r.startValue,r.destValue,t);};break;case"array":var l=r.value.length,f=_(_(r)),s=f.startValue,p=f.destValue,h=f.value;r._updateValue=function(t){for(var n=0;n<l;n++)h[n]=V(s[n],p[n],t);};break;case"object":var m=Object.keys(r.startValue),d=m.length,y=_(_(r)),v=y.startValue,b=y.destValue,w=y.value;r._updateValue=function(t){for(var n=0;n<d;n++){var e=m[n];w[e]=V(v[e],b[e],t);}};break;default:r.plugin?r._updateValue=function(t){r.value=r.plugin.interpolate(r.startValue,r.destValue,t,r.data);}:(console.warn("Between: startValue type was unrecognized."),r._updateValue=function(){return null});}return P.push(r.update()),r}return n(g,null,[{key:"between",value:function(){for(var t=arguments.length,n=new Array(t),e=0;e<t;e++)n[e]=arguments[e];return u(g,n)}}]),n(g,[{key:"pause",value:function(){return this[D]=!0,this.emit("pause",this.value,this,k),this}},{key:"play",value:function(){return this[D]=!1,this.emit("play",this.value,this,k),this}},{key:"easing",value:function(t){return this.ease=t,this}},{key:"time",value:function(t){return this.duration=t,this}},{key:"loop",value:function(){for(var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"once",n="__loop_".concat(t),e=arguments.length,r=new Array(1<e?e-1:0),u=1;u<e;u++)r[u-1]=arguments[u];return this.loopFunction=n in this?Object.assign({},g.DEFAULT_LOOP,this[n].apply(this,r)):g.DEFAULT_LOOP,this}},{key:"__loop_repeat",value:function(t){var n=this,e=t;return this.times=0,{complete:function(t){n.localTime=0,Number.isInteger(e)&&++n.times===e?t():Number.isInteger(e)||++n.times;}}}},{key:"__loop_bounce",value:function(t){var n=this,e=t,r=1;return this.times=0,{complete:function(t){n.localTime=0,r=-r,Number.isInteger(e)&&++n.times===e?t():Number.isInteger(e)||++n.times;},progress:function(t){return 0<r?t:1-t}}}},{key:"isPaused",get:function(){return this[D]}}]),function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function");o(t.prototype,n&&n.prototype),n&&o(t,n);}(g,t),g}(t);return M(E,"DEFAULT_LOOP",{complete:function(t){return t()},progress:function(t){return t}}),E.Easing=i,E._plugins={},E});
|
|
2575
|
-
}(between));
|
|
2666
|
+
var hasRequiredBetween;
|
|
2576
2667
|
|
|
2577
|
-
|
|
2668
|
+
function requireBetween () {
|
|
2669
|
+
if (hasRequiredBetween) return between$1.exports;
|
|
2670
|
+
hasRequiredBetween = 1;
|
|
2671
|
+
(function (module, exports) {
|
|
2672
|
+
!function(t,n){module.exports=n();}(between,function(){function O(t){return (O="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function r(t,n){for(var e=0;e<n.length;e++){var r=n[e];r.enumerable=r.enumerable||false,r.configurable=true,"value"in r&&(r.writable=true),Object.defineProperty(t,r.key,r);}}function n(t,n,e){return n&&r(t.prototype,n),e&&r(t,e),t}function M(t,n,e){return n in t?Object.defineProperty(t,n,{value:e,enumerable:true,configurable:true,writable:true}):t[n]=e,t}function I(t){return (I=Object.getPrototypeOf||function(t){return t.__proto__})(t)}function o(t,n){return (o=Object.setPrototypeOf||function(t,n){return t.__proto__=n,t})(t,n)}function u(t,n,e){return (u="undefined"!=typeof Reflect&&Reflect.construct?Reflect.construct:function(t,n,e){var r=[null];r.push.apply(r,n);var u=new(t.bind.apply(t,r));return e&&o(u,e.prototype),u}).apply(null,arguments)}function _(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}var t=function(o){var a={},i=[];(o=o||this).on=function(t,n,e){return (a[t]=a[t]||[]).push([n,e]),o},o.off=function(t,n){t||(a={});for(var e=a[t]||i,r=e.length=n?e.length:0;r--;)n==e[r][0]&&e.splice(r,1);return o},o.emit=function(t){for(var n,e=a[t]||i,r=0<e.length?e.slice(0,e.length):e,u=0;n=r[u++];)n[0].apply(n[1],i.slice.call(arguments,1));return o};};var V=function(t,n,e){return t*(1-e)+n*e},e="undefined"!=typeof window?window:"undefined"!=typeof commonjsGlobal?commonjsGlobal:"undefined"!=typeof self?self:{};function a(t,n){return t(n={exports:{}},n.exports),n.exports}for(var i=a(function(t){var n=t.exports={Linear:{None:function(t){return t}},Quadratic:{In:function(t){return t*t},Out:function(t){return t*(2-t)},InOut:function(t){return (t*=2)<1?.5*t*t:-0.5*(--t*(t-2)-1)}},Cubic:{In:function(t){return t*t*t},Out:function(t){return --t*t*t+1},InOut:function(t){return (t*=2)<1?.5*t*t*t:.5*((t-=2)*t*t+2)}},Quartic:{In:function(t){return t*t*t*t},Out:function(t){return 1- --t*t*t*t},InOut:function(t){return (t*=2)<1?.5*t*t*t*t:-0.5*((t-=2)*t*t*t-2)}},Quintic:{In:function(t){return t*t*t*t*t},Out:function(t){return --t*t*t*t*t+1},InOut:function(t){return (t*=2)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2)}},Sinusoidal:{In:function(t){return 1-Math.cos(t*Math.PI/2)},Out:function(t){return Math.sin(t*Math.PI/2)},InOut:function(t){return .5*(1-Math.cos(Math.PI*t))}},Exponential:{In:function(t){return 0===t?0:Math.pow(1024,t-1)},Out:function(t){return 1===t?1:1-Math.pow(2,-10*t)},InOut:function(t){return 0===t?0:1===t?1:(t*=2)<1?.5*Math.pow(1024,t-1):.5*(2-Math.pow(2,-10*(t-1)))}},Circular:{In:function(t){return 1-Math.sqrt(1-t*t)},Out:function(t){return Math.sqrt(1- --t*t)},InOut:function(t){return (t*=2)<1?-0.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)}},Elastic:{In:function(t){var n,e=.1;return 0===t?0:1===t?1:(!e||e<1?(e=1,n=.1):n=.4*Math.asin(1/e)/(2*Math.PI),-e*Math.pow(2,10*(t-=1))*Math.sin((t-n)*(2*Math.PI)/.4))},Out:function(t){var n,e=.1;return 0===t?0:1===t?1:(!e||e<1?(e=1,n=.1):n=.4*Math.asin(1/e)/(2*Math.PI),e*Math.pow(2,-10*t)*Math.sin((t-n)*(2*Math.PI)/.4)+1)},InOut:function(t){var n,e=.1;return 0===t?0:1===t?1:(!e||e<1?(e=1,n=.1):n=.4*Math.asin(1/e)/(2*Math.PI),(t*=2)<1?e*Math.pow(2,10*(t-=1))*Math.sin((t-n)*(2*Math.PI)/.4)*-0.5:e*Math.pow(2,-10*(t-=1))*Math.sin((t-n)*(2*Math.PI)/.4)*.5+1)}},Back:{In:function(t){return t*t*(2.70158*t-1.70158)},Out:function(t){return --t*t*(2.70158*t+1.70158)+1},InOut:function(t){var n=2.5949095;return (t*=2)<1?t*t*((n+1)*t-n)*.5:.5*((t-=2)*t*((n+1)*t+n)+2)}},Bounce:{In:function(t){return 1-n.Bounce.Out(1-t)},Out:function(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375},InOut:function(t){return t<.5?.5*n.Bounce.In(2*t):.5*n.Bounce.Out(2*t-1)+.5}}};}),c=(a(function(a){(function(){var t,n,e,r,u,o;"undefined"!=typeof performance&&null!==performance&&performance.now?a.exports=function(){return performance.now()}:"undefined"!=typeof process&&null!==process&&process.hrtime?(a.exports=function(){return (t()-u)/1e6},n=process.hrtime,r=(t=function(){var t;return 1e9*(t=n())[0]+t[1]})(),o=1e9*process.uptime(),u=r-o):Date.now?(a.exports=function(){return Date.now()-e},e=Date.now()):(a.exports=function(){return (new Date).getTime()-e},e=(new Date).getTime());}).call(e);})),l="undefined"==typeof window?e:window,f=["moz","webkit"],s="AnimationFrame",p=l["request"+s],h=l["cancel"+s]||l["cancelRequest"+s],m=0;!p&&m<f.length;m++)p=l[f[m]+"Request"+s],h=l[f[m]+"Cancel"+s]||l[f[m]+"CancelRequest"+s];if(!p||!h){var d=0,y=0,v=[];p=function(t){if(0===v.length){var n=c(),e=Math.max(0,1e3/60-(n-d));d=e+n,setTimeout(function(){for(var t=v.slice(0),n=v.length=0;n<t.length;n++)if(!t[n].cancelled)try{t[n].callback(d);}catch(t){setTimeout(function(){throw t},0);}},Math.round(e));}return v.push({handle:++y,callback:t,cancelled:false}),y},h=function(t){for(var n=0;n<v.length;n++)v[n].handle===t&&(v[n].cancelled=true);};}var b=function(t){return p.call(l,t)};b.cancel=function(){h.apply(l,arguments);},b.polyfill=function(t){t||(t=l),t.requestAnimationFrame=p,t.cancelAnimationFrame=h;};var w,k,P=[],T=Symbol("type"),j=Symbol("start_time"),x=Symbol("completed"),D=Symbol("paused"),g=requestAnimationFrame||b,A=Date.now();!function t(){g(t),w=Date.now(),k=w-A;for(var n=0;n<P.length;n++)P[n][x]||P[n](k,Date.now()-P[n][j]);A=w;}();var E=function(t){function g(e,t){var n,r,u,o;!function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}(this,g),u=this,o=I(g).call(this),M(_(_(r=!o||"object"!=typeof o&&"function"!=typeof o?_(u):o)),"update",function(){var e=_(_(r))._updateValue;return function(t,n){r[x]||r[D]||(0===r.localTime&&r.emit("start",r.value,_(_(r))),e(r.ease(r.loopFunction.progress(Math.min(1,(n||r.localTime)/r.duration)))),r.emit("update",r.value,_(_(r)),t),r.localTime>=r.duration&&r.loopFunction.complete(function(){r[x]=true,r.emit("complete",r.value,_(_(r)));}),r.localTime+=t);}});var a=r.plugin=Object.values(g._plugins).reduce(function(t,n){return t||n&&n.test&&n.test(e)&&n},false),i=a&&a.name||("object"===O(e)?Array.isArray(e)?"array":"object":"number");if(a){var c=a.initialize(e,t);e=c.startValue,t=c.destValue,r.data=c.data;}switch(Object.assign(_(_(r)),(M(n={duration:1e3,localTime:0,startValue:e,destValue:t,loopMode:"once",loopFunction:g.DEFAULT_LOOP,ease:function(t){return t},value:"array"===i?[].concat(e):"object"===i?Object.assign({},e):e},x,false),M(n,T,i),M(n,j,Date.now()),M(n,D,false),n)),r[T]){case "number":r._updateValue=function(t){r.value=V(r.startValue,r.destValue,t);};break;case "array":var l=r.value.length,f=_(_(r)),s=f.startValue,p=f.destValue,h=f.value;r._updateValue=function(t){for(var n=0;n<l;n++)h[n]=V(s[n],p[n],t);};break;case "object":var m=Object.keys(r.startValue),d=m.length,y=_(_(r)),v=y.startValue,b=y.destValue,w=y.value;r._updateValue=function(t){for(var n=0;n<d;n++){var e=m[n];w[e]=V(v[e],b[e],t);}};break;default:r.plugin?r._updateValue=function(t){r.value=r.plugin.interpolate(r.startValue,r.destValue,t,r.data);}:(console.warn("Between: startValue type was unrecognized."),r._updateValue=function(){return null});}return P.push(r.update()),r}return n(g,null,[{key:"between",value:function(){for(var t=arguments.length,n=new Array(t),e=0;e<t;e++)n[e]=arguments[e];return u(g,n)}}]),n(g,[{key:"pause",value:function(){return this[D]=true,this.emit("pause",this.value,this,k),this}},{key:"play",value:function(){return this[D]=false,this.emit("play",this.value,this,k),this}},{key:"easing",value:function(t){return this.ease=t,this}},{key:"time",value:function(t){return this.duration=t,this}},{key:"loop",value:function(){for(var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"once",n="__loop_".concat(t),e=arguments.length,r=new Array(1<e?e-1:0),u=1;u<e;u++)r[u-1]=arguments[u];return this.loopFunction=n in this?Object.assign({},g.DEFAULT_LOOP,this[n].apply(this,r)):g.DEFAULT_LOOP,this}},{key:"__loop_repeat",value:function(t){var n=this,e=t;return this.times=0,{complete:function(t){n.localTime=0,Number.isInteger(e)&&++n.times===e?t():Number.isInteger(e)||++n.times;}}}},{key:"__loop_bounce",value:function(t){var n=this,e=t,r=1;return this.times=0,{complete:function(t){n.localTime=0,r=-r,Number.isInteger(e)&&++n.times===e?t():Number.isInteger(e)||++n.times;},progress:function(t){return 0<r?t:1-t}}}},{key:"isPaused",get:function(){return this[D]}}]),function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function");o(t.prototype,n&&n.prototype),n&&o(t,n);}(g,t),g}(t);return M(E,"DEFAULT_LOOP",{complete:function(t){return t()},progress:function(t){return t}}),E.Easing=i,E._plugins={},E});
|
|
2673
|
+
} (between$1));
|
|
2674
|
+
return between$1.exports;
|
|
2675
|
+
}
|
|
2676
|
+
|
|
2677
|
+
var betweenExports = requireBetween();
|
|
2678
|
+
var Between = /*@__PURE__*/getDefaultExportFromCjs(betweenExports);
|
|
2578
2679
|
|
|
2579
2680
|
Between._plugins.color = ColorPlugin;
|
|
2580
2681
|
let barHeight = [];
|
|
@@ -2690,8 +2791,7 @@ const Eswat2Io = _props => {
|
|
|
2690
2791
|
h(Fingerprint, { label: "eswat2" })));
|
|
2691
2792
|
};
|
|
2692
2793
|
|
|
2693
|
-
const shadowCss = "/*! tailwindcss v4.0.
|
|
2694
|
-
const FunnelAppStyle0 = shadowCss;
|
|
2794
|
+
const shadowCss = "/*! tailwindcss v4.0.14 | MIT License | https://tailwindcss.com */\n@layer theme, base, components, utilities;\n@layer theme {\n :root,\n :host {\n --font-sans:\n ui-sans-serif, system-ui, sans-serif, 'Apple Color Emoji',\n 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';\n --spacing: 0.25rem;\n --text-xs: 0.75rem;\n --text-xs--line-height: calc(1 / 0.75);\n --font-weight-bold: 700;\n }\n}\n@layer utilities {\n .absolute {\n position: absolute;\n }\n .relative {\n position: relative;\n }\n .top-8 {\n top: calc(var(--spacing) * 8);\n }\n .right-8 {\n right: calc(var(--spacing) * 8);\n }\n .mt-3 {\n margin-top: calc(var(--spacing) * 3);\n }\n .mt-5px {\n margin-top: 5px;\n }\n .mr-0 {\n margin-right: calc(var(--spacing) * 0);\n }\n .mr-10px {\n margin-right: 10px;\n }\n .mb-10px {\n margin-bottom: 10px;\n }\n .ml-0 {\n margin-left: calc(var(--spacing) * 0);\n }\n .ml-auto {\n margin-left: auto;\n }\n .flex {\n display: flex;\n }\n .transform {\n transform: var(--tw-rotate-x) var(--tw-rotate-y) var(--tw-rotate-z)\n var(--tw-skew-x) var(--tw-skew-y);\n }\n .flex-col {\n flex-direction: column;\n }\n .flex-wrap {\n flex-wrap: wrap;\n }\n .items-center {\n align-items: center;\n }\n .border-solid {\n --tw-border-style: solid;\n border-style: solid;\n }\n .border-clrs-gray {\n border-color: var(--clrs-gray, #aaaaaa);\n }\n .border-clrs-slate {\n border-color: var(--clrs-slate, #708090);\n }\n .bg-clrs-blue {\n background-color: var(--clrs-blue, #0074d9);\n }\n .bg-clrs-red {\n background-color: var(--clrs-red, #ff4136);\n }\n .bg-clrs-silver {\n background-color: var(--clrs-silver, #dddddd);\n }\n .p-4 {\n padding: calc(var(--spacing) * 4);\n }\n .align-top {\n vertical-align: top;\n }\n .font-sans {\n font-family: var(--font-sans);\n }\n .text-xs {\n font-size: var(--text-xs);\n line-height: var(--tw-leading, var(--text-xs--line-height));\n }\n .font-bold {\n --tw-font-weight: var(--font-weight-bold);\n font-weight: var(--font-weight-bold);\n }\n .text-clrs-gray {\n color: var(--clrs-gray, #aaaaaa);\n }\n .text-clrs-navy {\n color: var(--clrs-navy, #001f3f);\n }\n .text-clrs-slate4 {\n color: var(--clrs-slate4, #4e5964);\n }\n .text-clrs-white {\n color: var(--clrs-white, #ffffff);\n }\n .italic {\n font-style: italic;\n }\n .shadow {\n --tw-shadow:\n 0 1px 3px 0 var(--tw-shadow-color, rgb(0 0 0 / 0.1)),\n 0 1px 2px -1px var(--tw-shadow-color, rgb(0 0 0 / 0.1));\n box-shadow:\n var(--tw-inset-shadow), var(--tw-inset-ring-shadow),\n var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);\n }\n .hover\\:text-clrs-navy {\n &:hover {\n @media (hover: hover) {\n color: var(--clrs-navy, #001f3f);\n }\n }\n }\n .active\\:bg-clrs-gray {\n &:active {\n background-color: var(--clrs-gray, #aaaaaa);\n }\n }\n .active\\:text-clrs-navy {\n &:active {\n color: var(--clrs-navy, #001f3f);\n }\n }\n}\n@layer components {\n .ds1-main {\n display: flex;\n flex-direction: column;\n padding: calc(var(--spacing) * 4);\n font-family: var(--font-sans);\n color: var(--clrs-navy, #001f3f);\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n }\n .ds1-button {\n display: flex;\n align-items: center;\n --tw-border-style: solid;\n border-style: solid;\n border-color: var(--clrs-slate, #708090);\n color: var(--clrs-white, #ffffff);\n &:active {\n background-color: var(--clrs-gray, #aaaaaa);\n }\n &:active {\n color: var(--clrs-navy, #001f3f);\n }\n }\n .funnel-gfx {\n --tw-border-style: solid;\n border-style: solid;\n border-color: var(--clrs-gray, #aaaaaa);\n background-color: var(--clrs-silver, #dddddd);\n stroke-width: 1;\n }\n}\n.data-button {\n border-radius: 5px;\n border-width: 1px;\n padding: 5px;\n margin: 0px;\n margin-right: 5px;\n cursor: pointer;\n}\n.funnel-gfx {\n width: calc(100% - 20px);\n height: 100%;\n padding: 10px;\n padding-bottom: 7px;\n border-radius: 10px;\n border-width: 1px;\n}\n";
|
|
2695
2795
|
|
|
2696
2796
|
const FunnelApp = class {
|
|
2697
2797
|
constructor(hostRef) {
|
|
@@ -2707,6 +2807,8 @@ const FunnelApp = class {
|
|
|
2707
2807
|
return (h("div", { key: '7998626a3f01e8bb4b2ed4b2b80d8b8de4a11206', id: "app", class: "ds1-main relative" }, h(Eswat2Io, { key: '44437debf47c76557ac6a115eec78b43a0aa2648' }), h(FunnelGfx, { key: 'f0806a91f365823850ab6ccebbc1339c18dd46b1' }), h(DataSource, { key: 'bfe9dc2f232eac7142d416c2dff3e7d8522930b7', actions: actions, state: state }), h(ColorPicker, { key: '23836d760ccb38b898857abd205ae186d8f05242', actions: actions, state: state }), h("hr", { key: '33eae1954a6b50e6a7b8c3124e92895114a8412d', class: "ml-0 mr-0" }), h(DataValues, { key: '4d449b22dedd37ce95356c98b00d5137008b5345', state: state })));
|
|
2708
2808
|
}
|
|
2709
2809
|
};
|
|
2710
|
-
FunnelApp.style =
|
|
2810
|
+
FunnelApp.style = shadowCss;
|
|
2711
2811
|
|
|
2712
2812
|
export { FunnelApp as funnel_app };
|
|
2813
|
+
|
|
2814
|
+
//# sourceMappingURL=funnel-app.entry.js.map
|