create-expo 3.6.2 → 3.6.3
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/build/300.index.js +1224 -0
- package/build/index.js +9 -9
- package/package.json +5 -5
package/build/300.index.js
CHANGED
|
@@ -196,6 +196,1230 @@ if ( true && module.exports) {
|
|
|
196
196
|
}
|
|
197
197
|
|
|
198
198
|
|
|
199
|
+
/***/ }),
|
|
200
|
+
|
|
201
|
+
/***/ 9308:
|
|
202
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
203
|
+
|
|
204
|
+
/* MIT license */
|
|
205
|
+
var cssKeywords = __webpack_require__(5324);
|
|
206
|
+
|
|
207
|
+
// NOTE: conversions should only return primitive values (i.e. arrays, or
|
|
208
|
+
// values that give correct `typeof` results).
|
|
209
|
+
// do not use box values types (i.e. Number(), String(), etc.)
|
|
210
|
+
|
|
211
|
+
var reverseKeywords = {};
|
|
212
|
+
for (var key in cssKeywords) {
|
|
213
|
+
if (cssKeywords.hasOwnProperty(key)) {
|
|
214
|
+
reverseKeywords[cssKeywords[key]] = key;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
var convert = module.exports = {
|
|
219
|
+
rgb: {channels: 3, labels: 'rgb'},
|
|
220
|
+
hsl: {channels: 3, labels: 'hsl'},
|
|
221
|
+
hsv: {channels: 3, labels: 'hsv'},
|
|
222
|
+
hwb: {channels: 3, labels: 'hwb'},
|
|
223
|
+
cmyk: {channels: 4, labels: 'cmyk'},
|
|
224
|
+
xyz: {channels: 3, labels: 'xyz'},
|
|
225
|
+
lab: {channels: 3, labels: 'lab'},
|
|
226
|
+
lch: {channels: 3, labels: 'lch'},
|
|
227
|
+
hex: {channels: 1, labels: ['hex']},
|
|
228
|
+
keyword: {channels: 1, labels: ['keyword']},
|
|
229
|
+
ansi16: {channels: 1, labels: ['ansi16']},
|
|
230
|
+
ansi256: {channels: 1, labels: ['ansi256']},
|
|
231
|
+
hcg: {channels: 3, labels: ['h', 'c', 'g']},
|
|
232
|
+
apple: {channels: 3, labels: ['r16', 'g16', 'b16']},
|
|
233
|
+
gray: {channels: 1, labels: ['gray']}
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
// hide .channels and .labels properties
|
|
237
|
+
for (var model in convert) {
|
|
238
|
+
if (convert.hasOwnProperty(model)) {
|
|
239
|
+
if (!('channels' in convert[model])) {
|
|
240
|
+
throw new Error('missing channels property: ' + model);
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
if (!('labels' in convert[model])) {
|
|
244
|
+
throw new Error('missing channel labels property: ' + model);
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
if (convert[model].labels.length !== convert[model].channels) {
|
|
248
|
+
throw new Error('channel and label counts mismatch: ' + model);
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
var channels = convert[model].channels;
|
|
252
|
+
var labels = convert[model].labels;
|
|
253
|
+
delete convert[model].channels;
|
|
254
|
+
delete convert[model].labels;
|
|
255
|
+
Object.defineProperty(convert[model], 'channels', {value: channels});
|
|
256
|
+
Object.defineProperty(convert[model], 'labels', {value: labels});
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
convert.rgb.hsl = function (rgb) {
|
|
261
|
+
var r = rgb[0] / 255;
|
|
262
|
+
var g = rgb[1] / 255;
|
|
263
|
+
var b = rgb[2] / 255;
|
|
264
|
+
var min = Math.min(r, g, b);
|
|
265
|
+
var max = Math.max(r, g, b);
|
|
266
|
+
var delta = max - min;
|
|
267
|
+
var h;
|
|
268
|
+
var s;
|
|
269
|
+
var l;
|
|
270
|
+
|
|
271
|
+
if (max === min) {
|
|
272
|
+
h = 0;
|
|
273
|
+
} else if (r === max) {
|
|
274
|
+
h = (g - b) / delta;
|
|
275
|
+
} else if (g === max) {
|
|
276
|
+
h = 2 + (b - r) / delta;
|
|
277
|
+
} else if (b === max) {
|
|
278
|
+
h = 4 + (r - g) / delta;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
h = Math.min(h * 60, 360);
|
|
282
|
+
|
|
283
|
+
if (h < 0) {
|
|
284
|
+
h += 360;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
l = (min + max) / 2;
|
|
288
|
+
|
|
289
|
+
if (max === min) {
|
|
290
|
+
s = 0;
|
|
291
|
+
} else if (l <= 0.5) {
|
|
292
|
+
s = delta / (max + min);
|
|
293
|
+
} else {
|
|
294
|
+
s = delta / (2 - max - min);
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
return [h, s * 100, l * 100];
|
|
298
|
+
};
|
|
299
|
+
|
|
300
|
+
convert.rgb.hsv = function (rgb) {
|
|
301
|
+
var rdif;
|
|
302
|
+
var gdif;
|
|
303
|
+
var bdif;
|
|
304
|
+
var h;
|
|
305
|
+
var s;
|
|
306
|
+
|
|
307
|
+
var r = rgb[0] / 255;
|
|
308
|
+
var g = rgb[1] / 255;
|
|
309
|
+
var b = rgb[2] / 255;
|
|
310
|
+
var v = Math.max(r, g, b);
|
|
311
|
+
var diff = v - Math.min(r, g, b);
|
|
312
|
+
var diffc = function (c) {
|
|
313
|
+
return (v - c) / 6 / diff + 1 / 2;
|
|
314
|
+
};
|
|
315
|
+
|
|
316
|
+
if (diff === 0) {
|
|
317
|
+
h = s = 0;
|
|
318
|
+
} else {
|
|
319
|
+
s = diff / v;
|
|
320
|
+
rdif = diffc(r);
|
|
321
|
+
gdif = diffc(g);
|
|
322
|
+
bdif = diffc(b);
|
|
323
|
+
|
|
324
|
+
if (r === v) {
|
|
325
|
+
h = bdif - gdif;
|
|
326
|
+
} else if (g === v) {
|
|
327
|
+
h = (1 / 3) + rdif - bdif;
|
|
328
|
+
} else if (b === v) {
|
|
329
|
+
h = (2 / 3) + gdif - rdif;
|
|
330
|
+
}
|
|
331
|
+
if (h < 0) {
|
|
332
|
+
h += 1;
|
|
333
|
+
} else if (h > 1) {
|
|
334
|
+
h -= 1;
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
return [
|
|
339
|
+
h * 360,
|
|
340
|
+
s * 100,
|
|
341
|
+
v * 100
|
|
342
|
+
];
|
|
343
|
+
};
|
|
344
|
+
|
|
345
|
+
convert.rgb.hwb = function (rgb) {
|
|
346
|
+
var r = rgb[0];
|
|
347
|
+
var g = rgb[1];
|
|
348
|
+
var b = rgb[2];
|
|
349
|
+
var h = convert.rgb.hsl(rgb)[0];
|
|
350
|
+
var w = 1 / 255 * Math.min(r, Math.min(g, b));
|
|
351
|
+
|
|
352
|
+
b = 1 - 1 / 255 * Math.max(r, Math.max(g, b));
|
|
353
|
+
|
|
354
|
+
return [h, w * 100, b * 100];
|
|
355
|
+
};
|
|
356
|
+
|
|
357
|
+
convert.rgb.cmyk = function (rgb) {
|
|
358
|
+
var r = rgb[0] / 255;
|
|
359
|
+
var g = rgb[1] / 255;
|
|
360
|
+
var b = rgb[2] / 255;
|
|
361
|
+
var c;
|
|
362
|
+
var m;
|
|
363
|
+
var y;
|
|
364
|
+
var k;
|
|
365
|
+
|
|
366
|
+
k = Math.min(1 - r, 1 - g, 1 - b);
|
|
367
|
+
c = (1 - r - k) / (1 - k) || 0;
|
|
368
|
+
m = (1 - g - k) / (1 - k) || 0;
|
|
369
|
+
y = (1 - b - k) / (1 - k) || 0;
|
|
370
|
+
|
|
371
|
+
return [c * 100, m * 100, y * 100, k * 100];
|
|
372
|
+
};
|
|
373
|
+
|
|
374
|
+
/**
|
|
375
|
+
* See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
|
376
|
+
* */
|
|
377
|
+
function comparativeDistance(x, y) {
|
|
378
|
+
return (
|
|
379
|
+
Math.pow(x[0] - y[0], 2) +
|
|
380
|
+
Math.pow(x[1] - y[1], 2) +
|
|
381
|
+
Math.pow(x[2] - y[2], 2)
|
|
382
|
+
);
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
convert.rgb.keyword = function (rgb) {
|
|
386
|
+
var reversed = reverseKeywords[rgb];
|
|
387
|
+
if (reversed) {
|
|
388
|
+
return reversed;
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
var currentClosestDistance = Infinity;
|
|
392
|
+
var currentClosestKeyword;
|
|
393
|
+
|
|
394
|
+
for (var keyword in cssKeywords) {
|
|
395
|
+
if (cssKeywords.hasOwnProperty(keyword)) {
|
|
396
|
+
var value = cssKeywords[keyword];
|
|
397
|
+
|
|
398
|
+
// Compute comparative distance
|
|
399
|
+
var distance = comparativeDistance(rgb, value);
|
|
400
|
+
|
|
401
|
+
// Check if its less, if so set as closest
|
|
402
|
+
if (distance < currentClosestDistance) {
|
|
403
|
+
currentClosestDistance = distance;
|
|
404
|
+
currentClosestKeyword = keyword;
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
return currentClosestKeyword;
|
|
410
|
+
};
|
|
411
|
+
|
|
412
|
+
convert.keyword.rgb = function (keyword) {
|
|
413
|
+
return cssKeywords[keyword];
|
|
414
|
+
};
|
|
415
|
+
|
|
416
|
+
convert.rgb.xyz = function (rgb) {
|
|
417
|
+
var r = rgb[0] / 255;
|
|
418
|
+
var g = rgb[1] / 255;
|
|
419
|
+
var b = rgb[2] / 255;
|
|
420
|
+
|
|
421
|
+
// assume sRGB
|
|
422
|
+
r = r > 0.04045 ? Math.pow(((r + 0.055) / 1.055), 2.4) : (r / 12.92);
|
|
423
|
+
g = g > 0.04045 ? Math.pow(((g + 0.055) / 1.055), 2.4) : (g / 12.92);
|
|
424
|
+
b = b > 0.04045 ? Math.pow(((b + 0.055) / 1.055), 2.4) : (b / 12.92);
|
|
425
|
+
|
|
426
|
+
var x = (r * 0.4124) + (g * 0.3576) + (b * 0.1805);
|
|
427
|
+
var y = (r * 0.2126) + (g * 0.7152) + (b * 0.0722);
|
|
428
|
+
var z = (r * 0.0193) + (g * 0.1192) + (b * 0.9505);
|
|
429
|
+
|
|
430
|
+
return [x * 100, y * 100, z * 100];
|
|
431
|
+
};
|
|
432
|
+
|
|
433
|
+
convert.rgb.lab = function (rgb) {
|
|
434
|
+
var xyz = convert.rgb.xyz(rgb);
|
|
435
|
+
var x = xyz[0];
|
|
436
|
+
var y = xyz[1];
|
|
437
|
+
var z = xyz[2];
|
|
438
|
+
var l;
|
|
439
|
+
var a;
|
|
440
|
+
var b;
|
|
441
|
+
|
|
442
|
+
x /= 95.047;
|
|
443
|
+
y /= 100;
|
|
444
|
+
z /= 108.883;
|
|
445
|
+
|
|
446
|
+
x = x > 0.008856 ? Math.pow(x, 1 / 3) : (7.787 * x) + (16 / 116);
|
|
447
|
+
y = y > 0.008856 ? Math.pow(y, 1 / 3) : (7.787 * y) + (16 / 116);
|
|
448
|
+
z = z > 0.008856 ? Math.pow(z, 1 / 3) : (7.787 * z) + (16 / 116);
|
|
449
|
+
|
|
450
|
+
l = (116 * y) - 16;
|
|
451
|
+
a = 500 * (x - y);
|
|
452
|
+
b = 200 * (y - z);
|
|
453
|
+
|
|
454
|
+
return [l, a, b];
|
|
455
|
+
};
|
|
456
|
+
|
|
457
|
+
convert.hsl.rgb = function (hsl) {
|
|
458
|
+
var h = hsl[0] / 360;
|
|
459
|
+
var s = hsl[1] / 100;
|
|
460
|
+
var l = hsl[2] / 100;
|
|
461
|
+
var t1;
|
|
462
|
+
var t2;
|
|
463
|
+
var t3;
|
|
464
|
+
var rgb;
|
|
465
|
+
var val;
|
|
466
|
+
|
|
467
|
+
if (s === 0) {
|
|
468
|
+
val = l * 255;
|
|
469
|
+
return [val, val, val];
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
if (l < 0.5) {
|
|
473
|
+
t2 = l * (1 + s);
|
|
474
|
+
} else {
|
|
475
|
+
t2 = l + s - l * s;
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
t1 = 2 * l - t2;
|
|
479
|
+
|
|
480
|
+
rgb = [0, 0, 0];
|
|
481
|
+
for (var i = 0; i < 3; i++) {
|
|
482
|
+
t3 = h + 1 / 3 * -(i - 1);
|
|
483
|
+
if (t3 < 0) {
|
|
484
|
+
t3++;
|
|
485
|
+
}
|
|
486
|
+
if (t3 > 1) {
|
|
487
|
+
t3--;
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
if (6 * t3 < 1) {
|
|
491
|
+
val = t1 + (t2 - t1) * 6 * t3;
|
|
492
|
+
} else if (2 * t3 < 1) {
|
|
493
|
+
val = t2;
|
|
494
|
+
} else if (3 * t3 < 2) {
|
|
495
|
+
val = t1 + (t2 - t1) * (2 / 3 - t3) * 6;
|
|
496
|
+
} else {
|
|
497
|
+
val = t1;
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
rgb[i] = val * 255;
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
return rgb;
|
|
504
|
+
};
|
|
505
|
+
|
|
506
|
+
convert.hsl.hsv = function (hsl) {
|
|
507
|
+
var h = hsl[0];
|
|
508
|
+
var s = hsl[1] / 100;
|
|
509
|
+
var l = hsl[2] / 100;
|
|
510
|
+
var smin = s;
|
|
511
|
+
var lmin = Math.max(l, 0.01);
|
|
512
|
+
var sv;
|
|
513
|
+
var v;
|
|
514
|
+
|
|
515
|
+
l *= 2;
|
|
516
|
+
s *= (l <= 1) ? l : 2 - l;
|
|
517
|
+
smin *= lmin <= 1 ? lmin : 2 - lmin;
|
|
518
|
+
v = (l + s) / 2;
|
|
519
|
+
sv = l === 0 ? (2 * smin) / (lmin + smin) : (2 * s) / (l + s);
|
|
520
|
+
|
|
521
|
+
return [h, sv * 100, v * 100];
|
|
522
|
+
};
|
|
523
|
+
|
|
524
|
+
convert.hsv.rgb = function (hsv) {
|
|
525
|
+
var h = hsv[0] / 60;
|
|
526
|
+
var s = hsv[1] / 100;
|
|
527
|
+
var v = hsv[2] / 100;
|
|
528
|
+
var hi = Math.floor(h) % 6;
|
|
529
|
+
|
|
530
|
+
var f = h - Math.floor(h);
|
|
531
|
+
var p = 255 * v * (1 - s);
|
|
532
|
+
var q = 255 * v * (1 - (s * f));
|
|
533
|
+
var t = 255 * v * (1 - (s * (1 - f)));
|
|
534
|
+
v *= 255;
|
|
535
|
+
|
|
536
|
+
switch (hi) {
|
|
537
|
+
case 0:
|
|
538
|
+
return [v, t, p];
|
|
539
|
+
case 1:
|
|
540
|
+
return [q, v, p];
|
|
541
|
+
case 2:
|
|
542
|
+
return [p, v, t];
|
|
543
|
+
case 3:
|
|
544
|
+
return [p, q, v];
|
|
545
|
+
case 4:
|
|
546
|
+
return [t, p, v];
|
|
547
|
+
case 5:
|
|
548
|
+
return [v, p, q];
|
|
549
|
+
}
|
|
550
|
+
};
|
|
551
|
+
|
|
552
|
+
convert.hsv.hsl = function (hsv) {
|
|
553
|
+
var h = hsv[0];
|
|
554
|
+
var s = hsv[1] / 100;
|
|
555
|
+
var v = hsv[2] / 100;
|
|
556
|
+
var vmin = Math.max(v, 0.01);
|
|
557
|
+
var lmin;
|
|
558
|
+
var sl;
|
|
559
|
+
var l;
|
|
560
|
+
|
|
561
|
+
l = (2 - s) * v;
|
|
562
|
+
lmin = (2 - s) * vmin;
|
|
563
|
+
sl = s * vmin;
|
|
564
|
+
sl /= (lmin <= 1) ? lmin : 2 - lmin;
|
|
565
|
+
sl = sl || 0;
|
|
566
|
+
l /= 2;
|
|
567
|
+
|
|
568
|
+
return [h, sl * 100, l * 100];
|
|
569
|
+
};
|
|
570
|
+
|
|
571
|
+
// http://dev.w3.org/csswg/css-color/#hwb-to-rgb
|
|
572
|
+
convert.hwb.rgb = function (hwb) {
|
|
573
|
+
var h = hwb[0] / 360;
|
|
574
|
+
var wh = hwb[1] / 100;
|
|
575
|
+
var bl = hwb[2] / 100;
|
|
576
|
+
var ratio = wh + bl;
|
|
577
|
+
var i;
|
|
578
|
+
var v;
|
|
579
|
+
var f;
|
|
580
|
+
var n;
|
|
581
|
+
|
|
582
|
+
// wh + bl cant be > 1
|
|
583
|
+
if (ratio > 1) {
|
|
584
|
+
wh /= ratio;
|
|
585
|
+
bl /= ratio;
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
i = Math.floor(6 * h);
|
|
589
|
+
v = 1 - bl;
|
|
590
|
+
f = 6 * h - i;
|
|
591
|
+
|
|
592
|
+
if ((i & 0x01) !== 0) {
|
|
593
|
+
f = 1 - f;
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
n = wh + f * (v - wh); // linear interpolation
|
|
597
|
+
|
|
598
|
+
var r;
|
|
599
|
+
var g;
|
|
600
|
+
var b;
|
|
601
|
+
switch (i) {
|
|
602
|
+
default:
|
|
603
|
+
case 6:
|
|
604
|
+
case 0: r = v; g = n; b = wh; break;
|
|
605
|
+
case 1: r = n; g = v; b = wh; break;
|
|
606
|
+
case 2: r = wh; g = v; b = n; break;
|
|
607
|
+
case 3: r = wh; g = n; b = v; break;
|
|
608
|
+
case 4: r = n; g = wh; b = v; break;
|
|
609
|
+
case 5: r = v; g = wh; b = n; break;
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
return [r * 255, g * 255, b * 255];
|
|
613
|
+
};
|
|
614
|
+
|
|
615
|
+
convert.cmyk.rgb = function (cmyk) {
|
|
616
|
+
var c = cmyk[0] / 100;
|
|
617
|
+
var m = cmyk[1] / 100;
|
|
618
|
+
var y = cmyk[2] / 100;
|
|
619
|
+
var k = cmyk[3] / 100;
|
|
620
|
+
var r;
|
|
621
|
+
var g;
|
|
622
|
+
var b;
|
|
623
|
+
|
|
624
|
+
r = 1 - Math.min(1, c * (1 - k) + k);
|
|
625
|
+
g = 1 - Math.min(1, m * (1 - k) + k);
|
|
626
|
+
b = 1 - Math.min(1, y * (1 - k) + k);
|
|
627
|
+
|
|
628
|
+
return [r * 255, g * 255, b * 255];
|
|
629
|
+
};
|
|
630
|
+
|
|
631
|
+
convert.xyz.rgb = function (xyz) {
|
|
632
|
+
var x = xyz[0] / 100;
|
|
633
|
+
var y = xyz[1] / 100;
|
|
634
|
+
var z = xyz[2] / 100;
|
|
635
|
+
var r;
|
|
636
|
+
var g;
|
|
637
|
+
var b;
|
|
638
|
+
|
|
639
|
+
r = (x * 3.2406) + (y * -1.5372) + (z * -0.4986);
|
|
640
|
+
g = (x * -0.9689) + (y * 1.8758) + (z * 0.0415);
|
|
641
|
+
b = (x * 0.0557) + (y * -0.2040) + (z * 1.0570);
|
|
642
|
+
|
|
643
|
+
// assume sRGB
|
|
644
|
+
r = r > 0.0031308
|
|
645
|
+
? ((1.055 * Math.pow(r, 1.0 / 2.4)) - 0.055)
|
|
646
|
+
: r * 12.92;
|
|
647
|
+
|
|
648
|
+
g = g > 0.0031308
|
|
649
|
+
? ((1.055 * Math.pow(g, 1.0 / 2.4)) - 0.055)
|
|
650
|
+
: g * 12.92;
|
|
651
|
+
|
|
652
|
+
b = b > 0.0031308
|
|
653
|
+
? ((1.055 * Math.pow(b, 1.0 / 2.4)) - 0.055)
|
|
654
|
+
: b * 12.92;
|
|
655
|
+
|
|
656
|
+
r = Math.min(Math.max(0, r), 1);
|
|
657
|
+
g = Math.min(Math.max(0, g), 1);
|
|
658
|
+
b = Math.min(Math.max(0, b), 1);
|
|
659
|
+
|
|
660
|
+
return [r * 255, g * 255, b * 255];
|
|
661
|
+
};
|
|
662
|
+
|
|
663
|
+
convert.xyz.lab = function (xyz) {
|
|
664
|
+
var x = xyz[0];
|
|
665
|
+
var y = xyz[1];
|
|
666
|
+
var z = xyz[2];
|
|
667
|
+
var l;
|
|
668
|
+
var a;
|
|
669
|
+
var b;
|
|
670
|
+
|
|
671
|
+
x /= 95.047;
|
|
672
|
+
y /= 100;
|
|
673
|
+
z /= 108.883;
|
|
674
|
+
|
|
675
|
+
x = x > 0.008856 ? Math.pow(x, 1 / 3) : (7.787 * x) + (16 / 116);
|
|
676
|
+
y = y > 0.008856 ? Math.pow(y, 1 / 3) : (7.787 * y) + (16 / 116);
|
|
677
|
+
z = z > 0.008856 ? Math.pow(z, 1 / 3) : (7.787 * z) + (16 / 116);
|
|
678
|
+
|
|
679
|
+
l = (116 * y) - 16;
|
|
680
|
+
a = 500 * (x - y);
|
|
681
|
+
b = 200 * (y - z);
|
|
682
|
+
|
|
683
|
+
return [l, a, b];
|
|
684
|
+
};
|
|
685
|
+
|
|
686
|
+
convert.lab.xyz = function (lab) {
|
|
687
|
+
var l = lab[0];
|
|
688
|
+
var a = lab[1];
|
|
689
|
+
var b = lab[2];
|
|
690
|
+
var x;
|
|
691
|
+
var y;
|
|
692
|
+
var z;
|
|
693
|
+
|
|
694
|
+
y = (l + 16) / 116;
|
|
695
|
+
x = a / 500 + y;
|
|
696
|
+
z = y - b / 200;
|
|
697
|
+
|
|
698
|
+
var y2 = Math.pow(y, 3);
|
|
699
|
+
var x2 = Math.pow(x, 3);
|
|
700
|
+
var z2 = Math.pow(z, 3);
|
|
701
|
+
y = y2 > 0.008856 ? y2 : (y - 16 / 116) / 7.787;
|
|
702
|
+
x = x2 > 0.008856 ? x2 : (x - 16 / 116) / 7.787;
|
|
703
|
+
z = z2 > 0.008856 ? z2 : (z - 16 / 116) / 7.787;
|
|
704
|
+
|
|
705
|
+
x *= 95.047;
|
|
706
|
+
y *= 100;
|
|
707
|
+
z *= 108.883;
|
|
708
|
+
|
|
709
|
+
return [x, y, z];
|
|
710
|
+
};
|
|
711
|
+
|
|
712
|
+
convert.lab.lch = function (lab) {
|
|
713
|
+
var l = lab[0];
|
|
714
|
+
var a = lab[1];
|
|
715
|
+
var b = lab[2];
|
|
716
|
+
var hr;
|
|
717
|
+
var h;
|
|
718
|
+
var c;
|
|
719
|
+
|
|
720
|
+
hr = Math.atan2(b, a);
|
|
721
|
+
h = hr * 360 / 2 / Math.PI;
|
|
722
|
+
|
|
723
|
+
if (h < 0) {
|
|
724
|
+
h += 360;
|
|
725
|
+
}
|
|
726
|
+
|
|
727
|
+
c = Math.sqrt(a * a + b * b);
|
|
728
|
+
|
|
729
|
+
return [l, c, h];
|
|
730
|
+
};
|
|
731
|
+
|
|
732
|
+
convert.lch.lab = function (lch) {
|
|
733
|
+
var l = lch[0];
|
|
734
|
+
var c = lch[1];
|
|
735
|
+
var h = lch[2];
|
|
736
|
+
var a;
|
|
737
|
+
var b;
|
|
738
|
+
var hr;
|
|
739
|
+
|
|
740
|
+
hr = h / 360 * 2 * Math.PI;
|
|
741
|
+
a = c * Math.cos(hr);
|
|
742
|
+
b = c * Math.sin(hr);
|
|
743
|
+
|
|
744
|
+
return [l, a, b];
|
|
745
|
+
};
|
|
746
|
+
|
|
747
|
+
convert.rgb.ansi16 = function (args) {
|
|
748
|
+
var r = args[0];
|
|
749
|
+
var g = args[1];
|
|
750
|
+
var b = args[2];
|
|
751
|
+
var value = 1 in arguments ? arguments[1] : convert.rgb.hsv(args)[2]; // hsv -> ansi16 optimization
|
|
752
|
+
|
|
753
|
+
value = Math.round(value / 50);
|
|
754
|
+
|
|
755
|
+
if (value === 0) {
|
|
756
|
+
return 30;
|
|
757
|
+
}
|
|
758
|
+
|
|
759
|
+
var ansi = 30
|
|
760
|
+
+ ((Math.round(b / 255) << 2)
|
|
761
|
+
| (Math.round(g / 255) << 1)
|
|
762
|
+
| Math.round(r / 255));
|
|
763
|
+
|
|
764
|
+
if (value === 2) {
|
|
765
|
+
ansi += 60;
|
|
766
|
+
}
|
|
767
|
+
|
|
768
|
+
return ansi;
|
|
769
|
+
};
|
|
770
|
+
|
|
771
|
+
convert.hsv.ansi16 = function (args) {
|
|
772
|
+
// optimization here; we already know the value and don't need to get
|
|
773
|
+
// it converted for us.
|
|
774
|
+
return convert.rgb.ansi16(convert.hsv.rgb(args), args[2]);
|
|
775
|
+
};
|
|
776
|
+
|
|
777
|
+
convert.rgb.ansi256 = function (args) {
|
|
778
|
+
var r = args[0];
|
|
779
|
+
var g = args[1];
|
|
780
|
+
var b = args[2];
|
|
781
|
+
|
|
782
|
+
// we use the extended greyscale palette here, with the exception of
|
|
783
|
+
// black and white. normal palette only has 4 greyscale shades.
|
|
784
|
+
if (r === g && g === b) {
|
|
785
|
+
if (r < 8) {
|
|
786
|
+
return 16;
|
|
787
|
+
}
|
|
788
|
+
|
|
789
|
+
if (r > 248) {
|
|
790
|
+
return 231;
|
|
791
|
+
}
|
|
792
|
+
|
|
793
|
+
return Math.round(((r - 8) / 247) * 24) + 232;
|
|
794
|
+
}
|
|
795
|
+
|
|
796
|
+
var ansi = 16
|
|
797
|
+
+ (36 * Math.round(r / 255 * 5))
|
|
798
|
+
+ (6 * Math.round(g / 255 * 5))
|
|
799
|
+
+ Math.round(b / 255 * 5);
|
|
800
|
+
|
|
801
|
+
return ansi;
|
|
802
|
+
};
|
|
803
|
+
|
|
804
|
+
convert.ansi16.rgb = function (args) {
|
|
805
|
+
var color = args % 10;
|
|
806
|
+
|
|
807
|
+
// handle greyscale
|
|
808
|
+
if (color === 0 || color === 7) {
|
|
809
|
+
if (args > 50) {
|
|
810
|
+
color += 3.5;
|
|
811
|
+
}
|
|
812
|
+
|
|
813
|
+
color = color / 10.5 * 255;
|
|
814
|
+
|
|
815
|
+
return [color, color, color];
|
|
816
|
+
}
|
|
817
|
+
|
|
818
|
+
var mult = (~~(args > 50) + 1) * 0.5;
|
|
819
|
+
var r = ((color & 1) * mult) * 255;
|
|
820
|
+
var g = (((color >> 1) & 1) * mult) * 255;
|
|
821
|
+
var b = (((color >> 2) & 1) * mult) * 255;
|
|
822
|
+
|
|
823
|
+
return [r, g, b];
|
|
824
|
+
};
|
|
825
|
+
|
|
826
|
+
convert.ansi256.rgb = function (args) {
|
|
827
|
+
// handle greyscale
|
|
828
|
+
if (args >= 232) {
|
|
829
|
+
var c = (args - 232) * 10 + 8;
|
|
830
|
+
return [c, c, c];
|
|
831
|
+
}
|
|
832
|
+
|
|
833
|
+
args -= 16;
|
|
834
|
+
|
|
835
|
+
var rem;
|
|
836
|
+
var r = Math.floor(args / 36) / 5 * 255;
|
|
837
|
+
var g = Math.floor((rem = args % 36) / 6) / 5 * 255;
|
|
838
|
+
var b = (rem % 6) / 5 * 255;
|
|
839
|
+
|
|
840
|
+
return [r, g, b];
|
|
841
|
+
};
|
|
842
|
+
|
|
843
|
+
convert.rgb.hex = function (args) {
|
|
844
|
+
var integer = ((Math.round(args[0]) & 0xFF) << 16)
|
|
845
|
+
+ ((Math.round(args[1]) & 0xFF) << 8)
|
|
846
|
+
+ (Math.round(args[2]) & 0xFF);
|
|
847
|
+
|
|
848
|
+
var string = integer.toString(16).toUpperCase();
|
|
849
|
+
return '000000'.substring(string.length) + string;
|
|
850
|
+
};
|
|
851
|
+
|
|
852
|
+
convert.hex.rgb = function (args) {
|
|
853
|
+
var match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);
|
|
854
|
+
if (!match) {
|
|
855
|
+
return [0, 0, 0];
|
|
856
|
+
}
|
|
857
|
+
|
|
858
|
+
var colorString = match[0];
|
|
859
|
+
|
|
860
|
+
if (match[0].length === 3) {
|
|
861
|
+
colorString = colorString.split('').map(function (char) {
|
|
862
|
+
return char + char;
|
|
863
|
+
}).join('');
|
|
864
|
+
}
|
|
865
|
+
|
|
866
|
+
var integer = parseInt(colorString, 16);
|
|
867
|
+
var r = (integer >> 16) & 0xFF;
|
|
868
|
+
var g = (integer >> 8) & 0xFF;
|
|
869
|
+
var b = integer & 0xFF;
|
|
870
|
+
|
|
871
|
+
return [r, g, b];
|
|
872
|
+
};
|
|
873
|
+
|
|
874
|
+
convert.rgb.hcg = function (rgb) {
|
|
875
|
+
var r = rgb[0] / 255;
|
|
876
|
+
var g = rgb[1] / 255;
|
|
877
|
+
var b = rgb[2] / 255;
|
|
878
|
+
var max = Math.max(Math.max(r, g), b);
|
|
879
|
+
var min = Math.min(Math.min(r, g), b);
|
|
880
|
+
var chroma = (max - min);
|
|
881
|
+
var grayscale;
|
|
882
|
+
var hue;
|
|
883
|
+
|
|
884
|
+
if (chroma < 1) {
|
|
885
|
+
grayscale = min / (1 - chroma);
|
|
886
|
+
} else {
|
|
887
|
+
grayscale = 0;
|
|
888
|
+
}
|
|
889
|
+
|
|
890
|
+
if (chroma <= 0) {
|
|
891
|
+
hue = 0;
|
|
892
|
+
} else
|
|
893
|
+
if (max === r) {
|
|
894
|
+
hue = ((g - b) / chroma) % 6;
|
|
895
|
+
} else
|
|
896
|
+
if (max === g) {
|
|
897
|
+
hue = 2 + (b - r) / chroma;
|
|
898
|
+
} else {
|
|
899
|
+
hue = 4 + (r - g) / chroma + 4;
|
|
900
|
+
}
|
|
901
|
+
|
|
902
|
+
hue /= 6;
|
|
903
|
+
hue %= 1;
|
|
904
|
+
|
|
905
|
+
return [hue * 360, chroma * 100, grayscale * 100];
|
|
906
|
+
};
|
|
907
|
+
|
|
908
|
+
convert.hsl.hcg = function (hsl) {
|
|
909
|
+
var s = hsl[1] / 100;
|
|
910
|
+
var l = hsl[2] / 100;
|
|
911
|
+
var c = 1;
|
|
912
|
+
var f = 0;
|
|
913
|
+
|
|
914
|
+
if (l < 0.5) {
|
|
915
|
+
c = 2.0 * s * l;
|
|
916
|
+
} else {
|
|
917
|
+
c = 2.0 * s * (1.0 - l);
|
|
918
|
+
}
|
|
919
|
+
|
|
920
|
+
if (c < 1.0) {
|
|
921
|
+
f = (l - 0.5 * c) / (1.0 - c);
|
|
922
|
+
}
|
|
923
|
+
|
|
924
|
+
return [hsl[0], c * 100, f * 100];
|
|
925
|
+
};
|
|
926
|
+
|
|
927
|
+
convert.hsv.hcg = function (hsv) {
|
|
928
|
+
var s = hsv[1] / 100;
|
|
929
|
+
var v = hsv[2] / 100;
|
|
930
|
+
|
|
931
|
+
var c = s * v;
|
|
932
|
+
var f = 0;
|
|
933
|
+
|
|
934
|
+
if (c < 1.0) {
|
|
935
|
+
f = (v - c) / (1 - c);
|
|
936
|
+
}
|
|
937
|
+
|
|
938
|
+
return [hsv[0], c * 100, f * 100];
|
|
939
|
+
};
|
|
940
|
+
|
|
941
|
+
convert.hcg.rgb = function (hcg) {
|
|
942
|
+
var h = hcg[0] / 360;
|
|
943
|
+
var c = hcg[1] / 100;
|
|
944
|
+
var g = hcg[2] / 100;
|
|
945
|
+
|
|
946
|
+
if (c === 0.0) {
|
|
947
|
+
return [g * 255, g * 255, g * 255];
|
|
948
|
+
}
|
|
949
|
+
|
|
950
|
+
var pure = [0, 0, 0];
|
|
951
|
+
var hi = (h % 1) * 6;
|
|
952
|
+
var v = hi % 1;
|
|
953
|
+
var w = 1 - v;
|
|
954
|
+
var mg = 0;
|
|
955
|
+
|
|
956
|
+
switch (Math.floor(hi)) {
|
|
957
|
+
case 0:
|
|
958
|
+
pure[0] = 1; pure[1] = v; pure[2] = 0; break;
|
|
959
|
+
case 1:
|
|
960
|
+
pure[0] = w; pure[1] = 1; pure[2] = 0; break;
|
|
961
|
+
case 2:
|
|
962
|
+
pure[0] = 0; pure[1] = 1; pure[2] = v; break;
|
|
963
|
+
case 3:
|
|
964
|
+
pure[0] = 0; pure[1] = w; pure[2] = 1; break;
|
|
965
|
+
case 4:
|
|
966
|
+
pure[0] = v; pure[1] = 0; pure[2] = 1; break;
|
|
967
|
+
default:
|
|
968
|
+
pure[0] = 1; pure[1] = 0; pure[2] = w;
|
|
969
|
+
}
|
|
970
|
+
|
|
971
|
+
mg = (1.0 - c) * g;
|
|
972
|
+
|
|
973
|
+
return [
|
|
974
|
+
(c * pure[0] + mg) * 255,
|
|
975
|
+
(c * pure[1] + mg) * 255,
|
|
976
|
+
(c * pure[2] + mg) * 255
|
|
977
|
+
];
|
|
978
|
+
};
|
|
979
|
+
|
|
980
|
+
convert.hcg.hsv = function (hcg) {
|
|
981
|
+
var c = hcg[1] / 100;
|
|
982
|
+
var g = hcg[2] / 100;
|
|
983
|
+
|
|
984
|
+
var v = c + g * (1.0 - c);
|
|
985
|
+
var f = 0;
|
|
986
|
+
|
|
987
|
+
if (v > 0.0) {
|
|
988
|
+
f = c / v;
|
|
989
|
+
}
|
|
990
|
+
|
|
991
|
+
return [hcg[0], f * 100, v * 100];
|
|
992
|
+
};
|
|
993
|
+
|
|
994
|
+
convert.hcg.hsl = function (hcg) {
|
|
995
|
+
var c = hcg[1] / 100;
|
|
996
|
+
var g = hcg[2] / 100;
|
|
997
|
+
|
|
998
|
+
var l = g * (1.0 - c) + 0.5 * c;
|
|
999
|
+
var s = 0;
|
|
1000
|
+
|
|
1001
|
+
if (l > 0.0 && l < 0.5) {
|
|
1002
|
+
s = c / (2 * l);
|
|
1003
|
+
} else
|
|
1004
|
+
if (l >= 0.5 && l < 1.0) {
|
|
1005
|
+
s = c / (2 * (1 - l));
|
|
1006
|
+
}
|
|
1007
|
+
|
|
1008
|
+
return [hcg[0], s * 100, l * 100];
|
|
1009
|
+
};
|
|
1010
|
+
|
|
1011
|
+
convert.hcg.hwb = function (hcg) {
|
|
1012
|
+
var c = hcg[1] / 100;
|
|
1013
|
+
var g = hcg[2] / 100;
|
|
1014
|
+
var v = c + g * (1.0 - c);
|
|
1015
|
+
return [hcg[0], (v - c) * 100, (1 - v) * 100];
|
|
1016
|
+
};
|
|
1017
|
+
|
|
1018
|
+
convert.hwb.hcg = function (hwb) {
|
|
1019
|
+
var w = hwb[1] / 100;
|
|
1020
|
+
var b = hwb[2] / 100;
|
|
1021
|
+
var v = 1 - b;
|
|
1022
|
+
var c = v - w;
|
|
1023
|
+
var g = 0;
|
|
1024
|
+
|
|
1025
|
+
if (c < 1) {
|
|
1026
|
+
g = (v - c) / (1 - c);
|
|
1027
|
+
}
|
|
1028
|
+
|
|
1029
|
+
return [hwb[0], c * 100, g * 100];
|
|
1030
|
+
};
|
|
1031
|
+
|
|
1032
|
+
convert.apple.rgb = function (apple) {
|
|
1033
|
+
return [(apple[0] / 65535) * 255, (apple[1] / 65535) * 255, (apple[2] / 65535) * 255];
|
|
1034
|
+
};
|
|
1035
|
+
|
|
1036
|
+
convert.rgb.apple = function (rgb) {
|
|
1037
|
+
return [(rgb[0] / 255) * 65535, (rgb[1] / 255) * 65535, (rgb[2] / 255) * 65535];
|
|
1038
|
+
};
|
|
1039
|
+
|
|
1040
|
+
convert.gray.rgb = function (args) {
|
|
1041
|
+
return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255];
|
|
1042
|
+
};
|
|
1043
|
+
|
|
1044
|
+
convert.gray.hsl = convert.gray.hsv = function (args) {
|
|
1045
|
+
return [0, 0, args[0]];
|
|
1046
|
+
};
|
|
1047
|
+
|
|
1048
|
+
convert.gray.hwb = function (gray) {
|
|
1049
|
+
return [0, 100, gray[0]];
|
|
1050
|
+
};
|
|
1051
|
+
|
|
1052
|
+
convert.gray.cmyk = function (gray) {
|
|
1053
|
+
return [0, 0, 0, gray[0]];
|
|
1054
|
+
};
|
|
1055
|
+
|
|
1056
|
+
convert.gray.lab = function (gray) {
|
|
1057
|
+
return [gray[0], 0, 0];
|
|
1058
|
+
};
|
|
1059
|
+
|
|
1060
|
+
convert.gray.hex = function (gray) {
|
|
1061
|
+
var val = Math.round(gray[0] / 100 * 255) & 0xFF;
|
|
1062
|
+
var integer = (val << 16) + (val << 8) + val;
|
|
1063
|
+
|
|
1064
|
+
var string = integer.toString(16).toUpperCase();
|
|
1065
|
+
return '000000'.substring(string.length) + string;
|
|
1066
|
+
};
|
|
1067
|
+
|
|
1068
|
+
convert.rgb.gray = function (rgb) {
|
|
1069
|
+
var val = (rgb[0] + rgb[1] + rgb[2]) / 3;
|
|
1070
|
+
return [val / 255 * 100];
|
|
1071
|
+
};
|
|
1072
|
+
|
|
1073
|
+
|
|
1074
|
+
/***/ }),
|
|
1075
|
+
|
|
1076
|
+
/***/ 8821:
|
|
1077
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
1078
|
+
|
|
1079
|
+
var conversions = __webpack_require__(9308);
|
|
1080
|
+
var route = __webpack_require__(4140);
|
|
1081
|
+
|
|
1082
|
+
var convert = {};
|
|
1083
|
+
|
|
1084
|
+
var models = Object.keys(conversions);
|
|
1085
|
+
|
|
1086
|
+
function wrapRaw(fn) {
|
|
1087
|
+
var wrappedFn = function (args) {
|
|
1088
|
+
if (args === undefined || args === null) {
|
|
1089
|
+
return args;
|
|
1090
|
+
}
|
|
1091
|
+
|
|
1092
|
+
if (arguments.length > 1) {
|
|
1093
|
+
args = Array.prototype.slice.call(arguments);
|
|
1094
|
+
}
|
|
1095
|
+
|
|
1096
|
+
return fn(args);
|
|
1097
|
+
};
|
|
1098
|
+
|
|
1099
|
+
// preserve .conversion property if there is one
|
|
1100
|
+
if ('conversion' in fn) {
|
|
1101
|
+
wrappedFn.conversion = fn.conversion;
|
|
1102
|
+
}
|
|
1103
|
+
|
|
1104
|
+
return wrappedFn;
|
|
1105
|
+
}
|
|
1106
|
+
|
|
1107
|
+
function wrapRounded(fn) {
|
|
1108
|
+
var wrappedFn = function (args) {
|
|
1109
|
+
if (args === undefined || args === null) {
|
|
1110
|
+
return args;
|
|
1111
|
+
}
|
|
1112
|
+
|
|
1113
|
+
if (arguments.length > 1) {
|
|
1114
|
+
args = Array.prototype.slice.call(arguments);
|
|
1115
|
+
}
|
|
1116
|
+
|
|
1117
|
+
var result = fn(args);
|
|
1118
|
+
|
|
1119
|
+
// we're assuming the result is an array here.
|
|
1120
|
+
// see notice in conversions.js; don't use box types
|
|
1121
|
+
// in conversion functions.
|
|
1122
|
+
if (typeof result === 'object') {
|
|
1123
|
+
for (var len = result.length, i = 0; i < len; i++) {
|
|
1124
|
+
result[i] = Math.round(result[i]);
|
|
1125
|
+
}
|
|
1126
|
+
}
|
|
1127
|
+
|
|
1128
|
+
return result;
|
|
1129
|
+
};
|
|
1130
|
+
|
|
1131
|
+
// preserve .conversion property if there is one
|
|
1132
|
+
if ('conversion' in fn) {
|
|
1133
|
+
wrappedFn.conversion = fn.conversion;
|
|
1134
|
+
}
|
|
1135
|
+
|
|
1136
|
+
return wrappedFn;
|
|
1137
|
+
}
|
|
1138
|
+
|
|
1139
|
+
models.forEach(function (fromModel) {
|
|
1140
|
+
convert[fromModel] = {};
|
|
1141
|
+
|
|
1142
|
+
Object.defineProperty(convert[fromModel], 'channels', {value: conversions[fromModel].channels});
|
|
1143
|
+
Object.defineProperty(convert[fromModel], 'labels', {value: conversions[fromModel].labels});
|
|
1144
|
+
|
|
1145
|
+
var routes = route(fromModel);
|
|
1146
|
+
var routeModels = Object.keys(routes);
|
|
1147
|
+
|
|
1148
|
+
routeModels.forEach(function (toModel) {
|
|
1149
|
+
var fn = routes[toModel];
|
|
1150
|
+
|
|
1151
|
+
convert[fromModel][toModel] = wrapRounded(fn);
|
|
1152
|
+
convert[fromModel][toModel].raw = wrapRaw(fn);
|
|
1153
|
+
});
|
|
1154
|
+
});
|
|
1155
|
+
|
|
1156
|
+
module.exports = convert;
|
|
1157
|
+
|
|
1158
|
+
|
|
1159
|
+
/***/ }),
|
|
1160
|
+
|
|
1161
|
+
/***/ 5324:
|
|
1162
|
+
/***/ ((module) => {
|
|
1163
|
+
|
|
1164
|
+
"use strict";
|
|
1165
|
+
|
|
1166
|
+
|
|
1167
|
+
module.exports = {
|
|
1168
|
+
"aliceblue": [240, 248, 255],
|
|
1169
|
+
"antiquewhite": [250, 235, 215],
|
|
1170
|
+
"aqua": [0, 255, 255],
|
|
1171
|
+
"aquamarine": [127, 255, 212],
|
|
1172
|
+
"azure": [240, 255, 255],
|
|
1173
|
+
"beige": [245, 245, 220],
|
|
1174
|
+
"bisque": [255, 228, 196],
|
|
1175
|
+
"black": [0, 0, 0],
|
|
1176
|
+
"blanchedalmond": [255, 235, 205],
|
|
1177
|
+
"blue": [0, 0, 255],
|
|
1178
|
+
"blueviolet": [138, 43, 226],
|
|
1179
|
+
"brown": [165, 42, 42],
|
|
1180
|
+
"burlywood": [222, 184, 135],
|
|
1181
|
+
"cadetblue": [95, 158, 160],
|
|
1182
|
+
"chartreuse": [127, 255, 0],
|
|
1183
|
+
"chocolate": [210, 105, 30],
|
|
1184
|
+
"coral": [255, 127, 80],
|
|
1185
|
+
"cornflowerblue": [100, 149, 237],
|
|
1186
|
+
"cornsilk": [255, 248, 220],
|
|
1187
|
+
"crimson": [220, 20, 60],
|
|
1188
|
+
"cyan": [0, 255, 255],
|
|
1189
|
+
"darkblue": [0, 0, 139],
|
|
1190
|
+
"darkcyan": [0, 139, 139],
|
|
1191
|
+
"darkgoldenrod": [184, 134, 11],
|
|
1192
|
+
"darkgray": [169, 169, 169],
|
|
1193
|
+
"darkgreen": [0, 100, 0],
|
|
1194
|
+
"darkgrey": [169, 169, 169],
|
|
1195
|
+
"darkkhaki": [189, 183, 107],
|
|
1196
|
+
"darkmagenta": [139, 0, 139],
|
|
1197
|
+
"darkolivegreen": [85, 107, 47],
|
|
1198
|
+
"darkorange": [255, 140, 0],
|
|
1199
|
+
"darkorchid": [153, 50, 204],
|
|
1200
|
+
"darkred": [139, 0, 0],
|
|
1201
|
+
"darksalmon": [233, 150, 122],
|
|
1202
|
+
"darkseagreen": [143, 188, 143],
|
|
1203
|
+
"darkslateblue": [72, 61, 139],
|
|
1204
|
+
"darkslategray": [47, 79, 79],
|
|
1205
|
+
"darkslategrey": [47, 79, 79],
|
|
1206
|
+
"darkturquoise": [0, 206, 209],
|
|
1207
|
+
"darkviolet": [148, 0, 211],
|
|
1208
|
+
"deeppink": [255, 20, 147],
|
|
1209
|
+
"deepskyblue": [0, 191, 255],
|
|
1210
|
+
"dimgray": [105, 105, 105],
|
|
1211
|
+
"dimgrey": [105, 105, 105],
|
|
1212
|
+
"dodgerblue": [30, 144, 255],
|
|
1213
|
+
"firebrick": [178, 34, 34],
|
|
1214
|
+
"floralwhite": [255, 250, 240],
|
|
1215
|
+
"forestgreen": [34, 139, 34],
|
|
1216
|
+
"fuchsia": [255, 0, 255],
|
|
1217
|
+
"gainsboro": [220, 220, 220],
|
|
1218
|
+
"ghostwhite": [248, 248, 255],
|
|
1219
|
+
"gold": [255, 215, 0],
|
|
1220
|
+
"goldenrod": [218, 165, 32],
|
|
1221
|
+
"gray": [128, 128, 128],
|
|
1222
|
+
"green": [0, 128, 0],
|
|
1223
|
+
"greenyellow": [173, 255, 47],
|
|
1224
|
+
"grey": [128, 128, 128],
|
|
1225
|
+
"honeydew": [240, 255, 240],
|
|
1226
|
+
"hotpink": [255, 105, 180],
|
|
1227
|
+
"indianred": [205, 92, 92],
|
|
1228
|
+
"indigo": [75, 0, 130],
|
|
1229
|
+
"ivory": [255, 255, 240],
|
|
1230
|
+
"khaki": [240, 230, 140],
|
|
1231
|
+
"lavender": [230, 230, 250],
|
|
1232
|
+
"lavenderblush": [255, 240, 245],
|
|
1233
|
+
"lawngreen": [124, 252, 0],
|
|
1234
|
+
"lemonchiffon": [255, 250, 205],
|
|
1235
|
+
"lightblue": [173, 216, 230],
|
|
1236
|
+
"lightcoral": [240, 128, 128],
|
|
1237
|
+
"lightcyan": [224, 255, 255],
|
|
1238
|
+
"lightgoldenrodyellow": [250, 250, 210],
|
|
1239
|
+
"lightgray": [211, 211, 211],
|
|
1240
|
+
"lightgreen": [144, 238, 144],
|
|
1241
|
+
"lightgrey": [211, 211, 211],
|
|
1242
|
+
"lightpink": [255, 182, 193],
|
|
1243
|
+
"lightsalmon": [255, 160, 122],
|
|
1244
|
+
"lightseagreen": [32, 178, 170],
|
|
1245
|
+
"lightskyblue": [135, 206, 250],
|
|
1246
|
+
"lightslategray": [119, 136, 153],
|
|
1247
|
+
"lightslategrey": [119, 136, 153],
|
|
1248
|
+
"lightsteelblue": [176, 196, 222],
|
|
1249
|
+
"lightyellow": [255, 255, 224],
|
|
1250
|
+
"lime": [0, 255, 0],
|
|
1251
|
+
"limegreen": [50, 205, 50],
|
|
1252
|
+
"linen": [250, 240, 230],
|
|
1253
|
+
"magenta": [255, 0, 255],
|
|
1254
|
+
"maroon": [128, 0, 0],
|
|
1255
|
+
"mediumaquamarine": [102, 205, 170],
|
|
1256
|
+
"mediumblue": [0, 0, 205],
|
|
1257
|
+
"mediumorchid": [186, 85, 211],
|
|
1258
|
+
"mediumpurple": [147, 112, 219],
|
|
1259
|
+
"mediumseagreen": [60, 179, 113],
|
|
1260
|
+
"mediumslateblue": [123, 104, 238],
|
|
1261
|
+
"mediumspringgreen": [0, 250, 154],
|
|
1262
|
+
"mediumturquoise": [72, 209, 204],
|
|
1263
|
+
"mediumvioletred": [199, 21, 133],
|
|
1264
|
+
"midnightblue": [25, 25, 112],
|
|
1265
|
+
"mintcream": [245, 255, 250],
|
|
1266
|
+
"mistyrose": [255, 228, 225],
|
|
1267
|
+
"moccasin": [255, 228, 181],
|
|
1268
|
+
"navajowhite": [255, 222, 173],
|
|
1269
|
+
"navy": [0, 0, 128],
|
|
1270
|
+
"oldlace": [253, 245, 230],
|
|
1271
|
+
"olive": [128, 128, 0],
|
|
1272
|
+
"olivedrab": [107, 142, 35],
|
|
1273
|
+
"orange": [255, 165, 0],
|
|
1274
|
+
"orangered": [255, 69, 0],
|
|
1275
|
+
"orchid": [218, 112, 214],
|
|
1276
|
+
"palegoldenrod": [238, 232, 170],
|
|
1277
|
+
"palegreen": [152, 251, 152],
|
|
1278
|
+
"paleturquoise": [175, 238, 238],
|
|
1279
|
+
"palevioletred": [219, 112, 147],
|
|
1280
|
+
"papayawhip": [255, 239, 213],
|
|
1281
|
+
"peachpuff": [255, 218, 185],
|
|
1282
|
+
"peru": [205, 133, 63],
|
|
1283
|
+
"pink": [255, 192, 203],
|
|
1284
|
+
"plum": [221, 160, 221],
|
|
1285
|
+
"powderblue": [176, 224, 230],
|
|
1286
|
+
"purple": [128, 0, 128],
|
|
1287
|
+
"rebeccapurple": [102, 51, 153],
|
|
1288
|
+
"red": [255, 0, 0],
|
|
1289
|
+
"rosybrown": [188, 143, 143],
|
|
1290
|
+
"royalblue": [65, 105, 225],
|
|
1291
|
+
"saddlebrown": [139, 69, 19],
|
|
1292
|
+
"salmon": [250, 128, 114],
|
|
1293
|
+
"sandybrown": [244, 164, 96],
|
|
1294
|
+
"seagreen": [46, 139, 87],
|
|
1295
|
+
"seashell": [255, 245, 238],
|
|
1296
|
+
"sienna": [160, 82, 45],
|
|
1297
|
+
"silver": [192, 192, 192],
|
|
1298
|
+
"skyblue": [135, 206, 235],
|
|
1299
|
+
"slateblue": [106, 90, 205],
|
|
1300
|
+
"slategray": [112, 128, 144],
|
|
1301
|
+
"slategrey": [112, 128, 144],
|
|
1302
|
+
"snow": [255, 250, 250],
|
|
1303
|
+
"springgreen": [0, 255, 127],
|
|
1304
|
+
"steelblue": [70, 130, 180],
|
|
1305
|
+
"tan": [210, 180, 140],
|
|
1306
|
+
"teal": [0, 128, 128],
|
|
1307
|
+
"thistle": [216, 191, 216],
|
|
1308
|
+
"tomato": [255, 99, 71],
|
|
1309
|
+
"turquoise": [64, 224, 208],
|
|
1310
|
+
"violet": [238, 130, 238],
|
|
1311
|
+
"wheat": [245, 222, 179],
|
|
1312
|
+
"white": [255, 255, 255],
|
|
1313
|
+
"whitesmoke": [245, 245, 245],
|
|
1314
|
+
"yellow": [255, 255, 0],
|
|
1315
|
+
"yellowgreen": [154, 205, 50]
|
|
1316
|
+
};
|
|
1317
|
+
|
|
1318
|
+
|
|
1319
|
+
/***/ }),
|
|
1320
|
+
|
|
1321
|
+
/***/ 4140:
|
|
1322
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
1323
|
+
|
|
1324
|
+
var conversions = __webpack_require__(9308);
|
|
1325
|
+
|
|
1326
|
+
/*
|
|
1327
|
+
this function routes a model to all other models.
|
|
1328
|
+
|
|
1329
|
+
all functions that are routed have a property `.conversion` attached
|
|
1330
|
+
to the returned synthetic function. This property is an array
|
|
1331
|
+
of strings, each with the steps in between the 'from' and 'to'
|
|
1332
|
+
color models (inclusive).
|
|
1333
|
+
|
|
1334
|
+
conversions that are not possible simply are not included.
|
|
1335
|
+
*/
|
|
1336
|
+
|
|
1337
|
+
function buildGraph() {
|
|
1338
|
+
var graph = {};
|
|
1339
|
+
// https://jsperf.com/object-keys-vs-for-in-with-closure/3
|
|
1340
|
+
var models = Object.keys(conversions);
|
|
1341
|
+
|
|
1342
|
+
for (var len = models.length, i = 0; i < len; i++) {
|
|
1343
|
+
graph[models[i]] = {
|
|
1344
|
+
// http://jsperf.com/1-vs-infinity
|
|
1345
|
+
// micro-opt, but this is simple.
|
|
1346
|
+
distance: -1,
|
|
1347
|
+
parent: null
|
|
1348
|
+
};
|
|
1349
|
+
}
|
|
1350
|
+
|
|
1351
|
+
return graph;
|
|
1352
|
+
}
|
|
1353
|
+
|
|
1354
|
+
// https://en.wikipedia.org/wiki/Breadth-first_search
|
|
1355
|
+
function deriveBFS(fromModel) {
|
|
1356
|
+
var graph = buildGraph();
|
|
1357
|
+
var queue = [fromModel]; // unshift -> queue -> pop
|
|
1358
|
+
|
|
1359
|
+
graph[fromModel].distance = 0;
|
|
1360
|
+
|
|
1361
|
+
while (queue.length) {
|
|
1362
|
+
var current = queue.pop();
|
|
1363
|
+
var adjacents = Object.keys(conversions[current]);
|
|
1364
|
+
|
|
1365
|
+
for (var len = adjacents.length, i = 0; i < len; i++) {
|
|
1366
|
+
var adjacent = adjacents[i];
|
|
1367
|
+
var node = graph[adjacent];
|
|
1368
|
+
|
|
1369
|
+
if (node.distance === -1) {
|
|
1370
|
+
node.distance = graph[current].distance + 1;
|
|
1371
|
+
node.parent = current;
|
|
1372
|
+
queue.unshift(adjacent);
|
|
1373
|
+
}
|
|
1374
|
+
}
|
|
1375
|
+
}
|
|
1376
|
+
|
|
1377
|
+
return graph;
|
|
1378
|
+
}
|
|
1379
|
+
|
|
1380
|
+
function link(from, to) {
|
|
1381
|
+
return function (args) {
|
|
1382
|
+
return to(from(args));
|
|
1383
|
+
};
|
|
1384
|
+
}
|
|
1385
|
+
|
|
1386
|
+
function wrapConversion(toModel, graph) {
|
|
1387
|
+
var path = [graph[toModel].parent, toModel];
|
|
1388
|
+
var fn = conversions[graph[toModel].parent][toModel];
|
|
1389
|
+
|
|
1390
|
+
var cur = graph[toModel].parent;
|
|
1391
|
+
while (graph[cur].parent) {
|
|
1392
|
+
path.unshift(graph[cur].parent);
|
|
1393
|
+
fn = link(conversions[graph[cur].parent][cur], fn);
|
|
1394
|
+
cur = graph[cur].parent;
|
|
1395
|
+
}
|
|
1396
|
+
|
|
1397
|
+
fn.conversion = path;
|
|
1398
|
+
return fn;
|
|
1399
|
+
}
|
|
1400
|
+
|
|
1401
|
+
module.exports = function (fromModel) {
|
|
1402
|
+
var graph = deriveBFS(fromModel);
|
|
1403
|
+
var conversion = {};
|
|
1404
|
+
|
|
1405
|
+
var models = Object.keys(graph);
|
|
1406
|
+
for (var len = models.length, i = 0; i < len; i++) {
|
|
1407
|
+
var toModel = models[i];
|
|
1408
|
+
var node = graph[toModel];
|
|
1409
|
+
|
|
1410
|
+
if (node.parent === null) {
|
|
1411
|
+
// no possible conversion, or this node is the source model.
|
|
1412
|
+
continue;
|
|
1413
|
+
}
|
|
1414
|
+
|
|
1415
|
+
conversion[toModel] = wrapConversion(toModel, graph);
|
|
1416
|
+
}
|
|
1417
|
+
|
|
1418
|
+
return conversion;
|
|
1419
|
+
};
|
|
1420
|
+
|
|
1421
|
+
|
|
1422
|
+
|
|
199
1423
|
/***/ }),
|
|
200
1424
|
|
|
201
1425
|
/***/ 414:
|