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