@tradejs/strategies 2.0.5 → 2.0.6
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/index.js +928 -1106
- package/dist/index.mjs +928 -1106
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -2671,7 +2671,7 @@ var require_package = __commonJS({
|
|
|
2671
2671
|
module2.exports = {
|
|
2672
2672
|
name: "winston",
|
|
2673
2673
|
description: "A logger for just about everything.",
|
|
2674
|
-
version: "3.
|
|
2674
|
+
version: "3.19.0",
|
|
2675
2675
|
author: "Charlie Robbins <charlie.robbins@gmail.com>",
|
|
2676
2676
|
maintainers: [
|
|
2677
2677
|
"David Hyde <dabh@alumni.stanford.edu>"
|
|
@@ -2694,7 +2694,7 @@ var require_package = __commonJS({
|
|
|
2694
2694
|
"stream"
|
|
2695
2695
|
],
|
|
2696
2696
|
dependencies: {
|
|
2697
|
-
"@dabh/diagnostics": "^2.0.
|
|
2697
|
+
"@dabh/diagnostics": "^2.0.8",
|
|
2698
2698
|
"@colors/colors": "^1.6.0",
|
|
2699
2699
|
async: "^3.2.3",
|
|
2700
2700
|
"is-stream": "^2.0.0",
|
|
@@ -2717,9 +2717,8 @@ var require_package = __commonJS({
|
|
|
2717
2717
|
"cross-spawn-async": "^2.2.5",
|
|
2718
2718
|
eslint: "^8.57.0",
|
|
2719
2719
|
hock: "^1.4.1",
|
|
2720
|
-
|
|
2721
|
-
|
|
2722
|
-
rimraf: "5.0.1",
|
|
2720
|
+
jest: "^29.7.0",
|
|
2721
|
+
rimraf: "5.0.10",
|
|
2723
2722
|
split2: "^4.1.0",
|
|
2724
2723
|
"std-mocks": "^2.0.0",
|
|
2725
2724
|
through2: "^4.0.2",
|
|
@@ -2730,11 +2729,12 @@ var require_package = __commonJS({
|
|
|
2730
2729
|
types: "./index.d.ts",
|
|
2731
2730
|
scripts: {
|
|
2732
2731
|
lint: "eslint lib/*.js lib/winston/*.js lib/winston/**/*.js --resolve-plugins-relative-to ./node_modules/@dabh/eslint-config-populist",
|
|
2733
|
-
test: "
|
|
2734
|
-
"test:
|
|
2735
|
-
"test:
|
|
2736
|
-
"test:
|
|
2737
|
-
build: "
|
|
2732
|
+
test: "jest",
|
|
2733
|
+
"test:unit": "jest -c test/jest.config.unit.js",
|
|
2734
|
+
"test:integration": "jest -c test/jest.config.integration.js",
|
|
2735
|
+
"test:typescript": "npx --package typescript tsc --project test",
|
|
2736
|
+
build: "babel lib -d dist",
|
|
2737
|
+
prebuild: "rimraf dist",
|
|
2738
2738
|
prepublishOnly: "npm run build"
|
|
2739
2739
|
},
|
|
2740
2740
|
engines: {
|
|
@@ -6418,306 +6418,250 @@ var require_production = __commonJS({
|
|
|
6418
6418
|
}
|
|
6419
6419
|
});
|
|
6420
6420
|
|
|
6421
|
-
// ../../node_modules
|
|
6422
|
-
var
|
|
6423
|
-
"../../node_modules
|
|
6421
|
+
// ../../node_modules/@so-ric/colorspace/dist/index.cjs.js
|
|
6422
|
+
var require_index_cjs = __commonJS({
|
|
6423
|
+
"../../node_modules/@so-ric/colorspace/dist/index.cjs.js"(exports2, module2) {
|
|
6424
6424
|
"use strict";
|
|
6425
|
-
|
|
6426
|
-
|
|
6427
|
-
|
|
6428
|
-
|
|
6429
|
-
|
|
6430
|
-
|
|
6431
|
-
|
|
6432
|
-
|
|
6433
|
-
|
|
6434
|
-
|
|
6435
|
-
|
|
6436
|
-
|
|
6437
|
-
|
|
6438
|
-
|
|
6439
|
-
|
|
6440
|
-
|
|
6441
|
-
|
|
6442
|
-
|
|
6443
|
-
|
|
6444
|
-
|
|
6445
|
-
|
|
6446
|
-
|
|
6447
|
-
|
|
6448
|
-
|
|
6449
|
-
|
|
6450
|
-
|
|
6451
|
-
|
|
6452
|
-
|
|
6453
|
-
|
|
6454
|
-
|
|
6455
|
-
|
|
6456
|
-
|
|
6457
|
-
|
|
6458
|
-
|
|
6459
|
-
|
|
6460
|
-
|
|
6461
|
-
|
|
6462
|
-
|
|
6463
|
-
|
|
6464
|
-
|
|
6465
|
-
|
|
6466
|
-
|
|
6467
|
-
|
|
6468
|
-
|
|
6469
|
-
|
|
6470
|
-
|
|
6471
|
-
|
|
6472
|
-
|
|
6473
|
-
|
|
6474
|
-
|
|
6475
|
-
|
|
6476
|
-
|
|
6477
|
-
|
|
6478
|
-
|
|
6479
|
-
|
|
6480
|
-
|
|
6481
|
-
|
|
6482
|
-
|
|
6483
|
-
|
|
6484
|
-
|
|
6485
|
-
|
|
6486
|
-
|
|
6487
|
-
|
|
6488
|
-
|
|
6489
|
-
|
|
6490
|
-
|
|
6491
|
-
|
|
6492
|
-
|
|
6493
|
-
|
|
6494
|
-
|
|
6495
|
-
|
|
6496
|
-
|
|
6497
|
-
|
|
6498
|
-
|
|
6499
|
-
|
|
6500
|
-
|
|
6501
|
-
|
|
6502
|
-
|
|
6503
|
-
|
|
6504
|
-
|
|
6505
|
-
|
|
6506
|
-
|
|
6507
|
-
|
|
6508
|
-
|
|
6509
|
-
|
|
6510
|
-
|
|
6511
|
-
|
|
6512
|
-
|
|
6513
|
-
|
|
6514
|
-
|
|
6515
|
-
|
|
6516
|
-
|
|
6517
|
-
|
|
6518
|
-
|
|
6519
|
-
|
|
6520
|
-
|
|
6521
|
-
|
|
6522
|
-
|
|
6523
|
-
|
|
6524
|
-
|
|
6525
|
-
|
|
6526
|
-
|
|
6527
|
-
|
|
6528
|
-
|
|
6529
|
-
|
|
6530
|
-
|
|
6531
|
-
|
|
6532
|
-
|
|
6533
|
-
|
|
6534
|
-
|
|
6535
|
-
|
|
6536
|
-
|
|
6537
|
-
|
|
6538
|
-
|
|
6539
|
-
|
|
6540
|
-
|
|
6541
|
-
|
|
6542
|
-
|
|
6543
|
-
|
|
6544
|
-
|
|
6545
|
-
|
|
6546
|
-
|
|
6547
|
-
|
|
6548
|
-
|
|
6549
|
-
|
|
6550
|
-
|
|
6551
|
-
|
|
6552
|
-
|
|
6553
|
-
|
|
6554
|
-
|
|
6555
|
-
|
|
6556
|
-
|
|
6557
|
-
|
|
6558
|
-
|
|
6559
|
-
|
|
6560
|
-
|
|
6561
|
-
|
|
6562
|
-
|
|
6563
|
-
|
|
6564
|
-
|
|
6565
|
-
|
|
6566
|
-
|
|
6567
|
-
|
|
6568
|
-
|
|
6569
|
-
|
|
6570
|
-
|
|
6571
|
-
|
|
6572
|
-
|
|
6573
|
-
|
|
6574
|
-
};
|
|
6575
|
-
}
|
|
6576
|
-
});
|
|
6577
|
-
|
|
6578
|
-
// ../../node_modules/simple-swizzle/node_modules/is-arrayish/index.js
|
|
6579
|
-
var require_is_arrayish = __commonJS({
|
|
6580
|
-
"../../node_modules/simple-swizzle/node_modules/is-arrayish/index.js"(exports2, module2) {
|
|
6581
|
-
"use strict";
|
|
6582
|
-
module2.exports = function isArrayish(obj) {
|
|
6583
|
-
if (!obj || typeof obj === "string") {
|
|
6584
|
-
return false;
|
|
6585
|
-
}
|
|
6586
|
-
return obj instanceof Array || Array.isArray(obj) || obj.length >= 0 && (obj.splice instanceof Function || Object.getOwnPropertyDescriptor(obj, obj.length - 1) && obj.constructor.name !== "String");
|
|
6587
|
-
};
|
|
6588
|
-
}
|
|
6589
|
-
});
|
|
6590
|
-
|
|
6591
|
-
// ../../node_modules/simple-swizzle/index.js
|
|
6592
|
-
var require_simple_swizzle = __commonJS({
|
|
6593
|
-
"../../node_modules/simple-swizzle/index.js"(exports2, module2) {
|
|
6594
|
-
"use strict";
|
|
6595
|
-
var isArrayish = require_is_arrayish();
|
|
6596
|
-
var concat = Array.prototype.concat;
|
|
6597
|
-
var slice = Array.prototype.slice;
|
|
6598
|
-
var swizzle = module2.exports = function swizzle2(args) {
|
|
6599
|
-
var results = [];
|
|
6600
|
-
for (var i = 0, len = args.length; i < len; i++) {
|
|
6601
|
-
var arg = args[i];
|
|
6602
|
-
if (isArrayish(arg)) {
|
|
6603
|
-
results = concat.call(results, slice.call(arg));
|
|
6604
|
-
} else {
|
|
6605
|
-
results.push(arg);
|
|
6606
|
-
}
|
|
6607
|
-
}
|
|
6608
|
-
return results;
|
|
6425
|
+
var cssKeywords = {
|
|
6426
|
+
aliceblue: [240, 248, 255],
|
|
6427
|
+
antiquewhite: [250, 235, 215],
|
|
6428
|
+
aqua: [0, 255, 255],
|
|
6429
|
+
aquamarine: [127, 255, 212],
|
|
6430
|
+
azure: [240, 255, 255],
|
|
6431
|
+
beige: [245, 245, 220],
|
|
6432
|
+
bisque: [255, 228, 196],
|
|
6433
|
+
black: [0, 0, 0],
|
|
6434
|
+
blanchedalmond: [255, 235, 205],
|
|
6435
|
+
blue: [0, 0, 255],
|
|
6436
|
+
blueviolet: [138, 43, 226],
|
|
6437
|
+
brown: [165, 42, 42],
|
|
6438
|
+
burlywood: [222, 184, 135],
|
|
6439
|
+
cadetblue: [95, 158, 160],
|
|
6440
|
+
chartreuse: [127, 255, 0],
|
|
6441
|
+
chocolate: [210, 105, 30],
|
|
6442
|
+
coral: [255, 127, 80],
|
|
6443
|
+
cornflowerblue: [100, 149, 237],
|
|
6444
|
+
cornsilk: [255, 248, 220],
|
|
6445
|
+
crimson: [220, 20, 60],
|
|
6446
|
+
cyan: [0, 255, 255],
|
|
6447
|
+
darkblue: [0, 0, 139],
|
|
6448
|
+
darkcyan: [0, 139, 139],
|
|
6449
|
+
darkgoldenrod: [184, 134, 11],
|
|
6450
|
+
darkgray: [169, 169, 169],
|
|
6451
|
+
darkgreen: [0, 100, 0],
|
|
6452
|
+
darkgrey: [169, 169, 169],
|
|
6453
|
+
darkkhaki: [189, 183, 107],
|
|
6454
|
+
darkmagenta: [139, 0, 139],
|
|
6455
|
+
darkolivegreen: [85, 107, 47],
|
|
6456
|
+
darkorange: [255, 140, 0],
|
|
6457
|
+
darkorchid: [153, 50, 204],
|
|
6458
|
+
darkred: [139, 0, 0],
|
|
6459
|
+
darksalmon: [233, 150, 122],
|
|
6460
|
+
darkseagreen: [143, 188, 143],
|
|
6461
|
+
darkslateblue: [72, 61, 139],
|
|
6462
|
+
darkslategray: [47, 79, 79],
|
|
6463
|
+
darkslategrey: [47, 79, 79],
|
|
6464
|
+
darkturquoise: [0, 206, 209],
|
|
6465
|
+
darkviolet: [148, 0, 211],
|
|
6466
|
+
deeppink: [255, 20, 147],
|
|
6467
|
+
deepskyblue: [0, 191, 255],
|
|
6468
|
+
dimgray: [105, 105, 105],
|
|
6469
|
+
dimgrey: [105, 105, 105],
|
|
6470
|
+
dodgerblue: [30, 144, 255],
|
|
6471
|
+
firebrick: [178, 34, 34],
|
|
6472
|
+
floralwhite: [255, 250, 240],
|
|
6473
|
+
forestgreen: [34, 139, 34],
|
|
6474
|
+
fuchsia: [255, 0, 255],
|
|
6475
|
+
gainsboro: [220, 220, 220],
|
|
6476
|
+
ghostwhite: [248, 248, 255],
|
|
6477
|
+
gold: [255, 215, 0],
|
|
6478
|
+
goldenrod: [218, 165, 32],
|
|
6479
|
+
gray: [128, 128, 128],
|
|
6480
|
+
green: [0, 128, 0],
|
|
6481
|
+
greenyellow: [173, 255, 47],
|
|
6482
|
+
grey: [128, 128, 128],
|
|
6483
|
+
honeydew: [240, 255, 240],
|
|
6484
|
+
hotpink: [255, 105, 180],
|
|
6485
|
+
indianred: [205, 92, 92],
|
|
6486
|
+
indigo: [75, 0, 130],
|
|
6487
|
+
ivory: [255, 255, 240],
|
|
6488
|
+
khaki: [240, 230, 140],
|
|
6489
|
+
lavender: [230, 230, 250],
|
|
6490
|
+
lavenderblush: [255, 240, 245],
|
|
6491
|
+
lawngreen: [124, 252, 0],
|
|
6492
|
+
lemonchiffon: [255, 250, 205],
|
|
6493
|
+
lightblue: [173, 216, 230],
|
|
6494
|
+
lightcoral: [240, 128, 128],
|
|
6495
|
+
lightcyan: [224, 255, 255],
|
|
6496
|
+
lightgoldenrodyellow: [250, 250, 210],
|
|
6497
|
+
lightgray: [211, 211, 211],
|
|
6498
|
+
lightgreen: [144, 238, 144],
|
|
6499
|
+
lightgrey: [211, 211, 211],
|
|
6500
|
+
lightpink: [255, 182, 193],
|
|
6501
|
+
lightsalmon: [255, 160, 122],
|
|
6502
|
+
lightseagreen: [32, 178, 170],
|
|
6503
|
+
lightskyblue: [135, 206, 250],
|
|
6504
|
+
lightslategray: [119, 136, 153],
|
|
6505
|
+
lightslategrey: [119, 136, 153],
|
|
6506
|
+
lightsteelblue: [176, 196, 222],
|
|
6507
|
+
lightyellow: [255, 255, 224],
|
|
6508
|
+
lime: [0, 255, 0],
|
|
6509
|
+
limegreen: [50, 205, 50],
|
|
6510
|
+
linen: [250, 240, 230],
|
|
6511
|
+
magenta: [255, 0, 255],
|
|
6512
|
+
maroon: [128, 0, 0],
|
|
6513
|
+
mediumaquamarine: [102, 205, 170],
|
|
6514
|
+
mediumblue: [0, 0, 205],
|
|
6515
|
+
mediumorchid: [186, 85, 211],
|
|
6516
|
+
mediumpurple: [147, 112, 219],
|
|
6517
|
+
mediumseagreen: [60, 179, 113],
|
|
6518
|
+
mediumslateblue: [123, 104, 238],
|
|
6519
|
+
mediumspringgreen: [0, 250, 154],
|
|
6520
|
+
mediumturquoise: [72, 209, 204],
|
|
6521
|
+
mediumvioletred: [199, 21, 133],
|
|
6522
|
+
midnightblue: [25, 25, 112],
|
|
6523
|
+
mintcream: [245, 255, 250],
|
|
6524
|
+
mistyrose: [255, 228, 225],
|
|
6525
|
+
moccasin: [255, 228, 181],
|
|
6526
|
+
navajowhite: [255, 222, 173],
|
|
6527
|
+
navy: [0, 0, 128],
|
|
6528
|
+
oldlace: [253, 245, 230],
|
|
6529
|
+
olive: [128, 128, 0],
|
|
6530
|
+
olivedrab: [107, 142, 35],
|
|
6531
|
+
orange: [255, 165, 0],
|
|
6532
|
+
orangered: [255, 69, 0],
|
|
6533
|
+
orchid: [218, 112, 214],
|
|
6534
|
+
palegoldenrod: [238, 232, 170],
|
|
6535
|
+
palegreen: [152, 251, 152],
|
|
6536
|
+
paleturquoise: [175, 238, 238],
|
|
6537
|
+
palevioletred: [219, 112, 147],
|
|
6538
|
+
papayawhip: [255, 239, 213],
|
|
6539
|
+
peachpuff: [255, 218, 185],
|
|
6540
|
+
peru: [205, 133, 63],
|
|
6541
|
+
pink: [255, 192, 203],
|
|
6542
|
+
plum: [221, 160, 221],
|
|
6543
|
+
powderblue: [176, 224, 230],
|
|
6544
|
+
purple: [128, 0, 128],
|
|
6545
|
+
rebeccapurple: [102, 51, 153],
|
|
6546
|
+
red: [255, 0, 0],
|
|
6547
|
+
rosybrown: [188, 143, 143],
|
|
6548
|
+
royalblue: [65, 105, 225],
|
|
6549
|
+
saddlebrown: [139, 69, 19],
|
|
6550
|
+
salmon: [250, 128, 114],
|
|
6551
|
+
sandybrown: [244, 164, 96],
|
|
6552
|
+
seagreen: [46, 139, 87],
|
|
6553
|
+
seashell: [255, 245, 238],
|
|
6554
|
+
sienna: [160, 82, 45],
|
|
6555
|
+
silver: [192, 192, 192],
|
|
6556
|
+
skyblue: [135, 206, 235],
|
|
6557
|
+
slateblue: [106, 90, 205],
|
|
6558
|
+
slategray: [112, 128, 144],
|
|
6559
|
+
slategrey: [112, 128, 144],
|
|
6560
|
+
snow: [255, 250, 250],
|
|
6561
|
+
springgreen: [0, 255, 127],
|
|
6562
|
+
steelblue: [70, 130, 180],
|
|
6563
|
+
tan: [210, 180, 140],
|
|
6564
|
+
teal: [0, 128, 128],
|
|
6565
|
+
thistle: [216, 191, 216],
|
|
6566
|
+
tomato: [255, 99, 71],
|
|
6567
|
+
turquoise: [64, 224, 208],
|
|
6568
|
+
violet: [238, 130, 238],
|
|
6569
|
+
wheat: [245, 222, 179],
|
|
6570
|
+
white: [255, 255, 255],
|
|
6571
|
+
whitesmoke: [245, 245, 245],
|
|
6572
|
+
yellow: [255, 255, 0],
|
|
6573
|
+
yellowgreen: [154, 205, 50]
|
|
6609
6574
|
};
|
|
6610
|
-
swizzle.wrap = function(fn) {
|
|
6611
|
-
return function() {
|
|
6612
|
-
return fn(swizzle(arguments));
|
|
6613
|
-
};
|
|
6614
|
-
};
|
|
6615
|
-
}
|
|
6616
|
-
});
|
|
6617
|
-
|
|
6618
|
-
// ../../node_modules/color-string/index.js
|
|
6619
|
-
var require_color_string = __commonJS({
|
|
6620
|
-
"../../node_modules/color-string/index.js"(exports2, module2) {
|
|
6621
|
-
"use strict";
|
|
6622
|
-
var colorNames = require_color_name();
|
|
6623
|
-
var swizzle = require_simple_swizzle();
|
|
6624
|
-
var hasOwnProperty = Object.hasOwnProperty;
|
|
6625
6575
|
var reverseNames = /* @__PURE__ */ Object.create(null);
|
|
6626
|
-
for (name in
|
|
6627
|
-
if (
|
|
6628
|
-
reverseNames[
|
|
6576
|
+
for (const name in cssKeywords) {
|
|
6577
|
+
if (Object.hasOwn(cssKeywords, name)) {
|
|
6578
|
+
reverseNames[cssKeywords[name]] = name;
|
|
6629
6579
|
}
|
|
6630
6580
|
}
|
|
6631
|
-
var
|
|
6632
|
-
var cs = module2.exports = {
|
|
6581
|
+
var cs = {
|
|
6633
6582
|
to: {},
|
|
6634
6583
|
get: {}
|
|
6635
6584
|
};
|
|
6636
6585
|
cs.get = function(string) {
|
|
6637
|
-
|
|
6638
|
-
|
|
6639
|
-
|
|
6586
|
+
const prefix = string.slice(0, 3).toLowerCase();
|
|
6587
|
+
let value;
|
|
6588
|
+
let model;
|
|
6640
6589
|
switch (prefix) {
|
|
6641
|
-
case "hsl":
|
|
6642
|
-
|
|
6590
|
+
case "hsl": {
|
|
6591
|
+
value = cs.get.hsl(string);
|
|
6643
6592
|
model = "hsl";
|
|
6644
6593
|
break;
|
|
6645
|
-
|
|
6646
|
-
|
|
6594
|
+
}
|
|
6595
|
+
case "hwb": {
|
|
6596
|
+
value = cs.get.hwb(string);
|
|
6647
6597
|
model = "hwb";
|
|
6648
6598
|
break;
|
|
6649
|
-
|
|
6650
|
-
|
|
6599
|
+
}
|
|
6600
|
+
default: {
|
|
6601
|
+
value = cs.get.rgb(string);
|
|
6651
6602
|
model = "rgb";
|
|
6652
6603
|
break;
|
|
6604
|
+
}
|
|
6653
6605
|
}
|
|
6654
|
-
if (!
|
|
6606
|
+
if (!value) {
|
|
6655
6607
|
return null;
|
|
6656
6608
|
}
|
|
6657
|
-
return { model, value
|
|
6609
|
+
return { model, value };
|
|
6658
6610
|
};
|
|
6659
6611
|
cs.get.rgb = function(string) {
|
|
6660
6612
|
if (!string) {
|
|
6661
6613
|
return null;
|
|
6662
6614
|
}
|
|
6663
|
-
|
|
6664
|
-
|
|
6665
|
-
|
|
6666
|
-
|
|
6667
|
-
|
|
6668
|
-
|
|
6669
|
-
|
|
6670
|
-
|
|
6671
|
-
|
|
6672
|
-
if (match = string.match(
|
|
6615
|
+
const abbr = /^#([a-f\d]{3,4})$/i;
|
|
6616
|
+
const hex2 = /^#([a-f\d]{6})([a-f\d]{2})?$/i;
|
|
6617
|
+
const rgba = /^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[\s,|/]\s*([+-]?[\d.]+)(%?)\s*)?\)$/;
|
|
6618
|
+
const per = /^rgba?\(\s*([+-]?[\d.]+)%\s*,?\s*([+-]?[\d.]+)%\s*,?\s*([+-]?[\d.]+)%\s*(?:[\s,|/]\s*([+-]?[\d.]+)(%?)\s*)?\)$/;
|
|
6619
|
+
const keyword = /^(\w+)$/;
|
|
6620
|
+
let rgb = [0, 0, 0, 1];
|
|
6621
|
+
let match;
|
|
6622
|
+
let i;
|
|
6623
|
+
let hexAlpha;
|
|
6624
|
+
if (match = string.match(hex2)) {
|
|
6673
6625
|
hexAlpha = match[2];
|
|
6674
6626
|
match = match[1];
|
|
6675
6627
|
for (i = 0; i < 3; i++) {
|
|
6676
|
-
|
|
6677
|
-
rgb[i] = parseInt(match.slice(i2, i2 + 2), 16);
|
|
6628
|
+
const i2 = i * 2;
|
|
6629
|
+
rgb[i] = Number.parseInt(match.slice(i2, i2 + 2), 16);
|
|
6678
6630
|
}
|
|
6679
6631
|
if (hexAlpha) {
|
|
6680
|
-
rgb[3] = parseInt(hexAlpha, 16) / 255;
|
|
6632
|
+
rgb[3] = Number.parseInt(hexAlpha, 16) / 255;
|
|
6681
6633
|
}
|
|
6682
6634
|
} else if (match = string.match(abbr)) {
|
|
6683
6635
|
match = match[1];
|
|
6684
6636
|
hexAlpha = match[3];
|
|
6685
6637
|
for (i = 0; i < 3; i++) {
|
|
6686
|
-
rgb[i] = parseInt(match[i] + match[i], 16);
|
|
6638
|
+
rgb[i] = Number.parseInt(match[i] + match[i], 16);
|
|
6687
6639
|
}
|
|
6688
6640
|
if (hexAlpha) {
|
|
6689
|
-
rgb[3] = parseInt(hexAlpha + hexAlpha, 16) / 255;
|
|
6641
|
+
rgb[3] = Number.parseInt(hexAlpha + hexAlpha, 16) / 255;
|
|
6690
6642
|
}
|
|
6691
6643
|
} else if (match = string.match(rgba)) {
|
|
6692
6644
|
for (i = 0; i < 3; i++) {
|
|
6693
|
-
rgb[i] = parseInt(match[i + 1],
|
|
6645
|
+
rgb[i] = Number.parseInt(match[i + 1], 10);
|
|
6694
6646
|
}
|
|
6695
6647
|
if (match[4]) {
|
|
6696
|
-
|
|
6697
|
-
rgb[3] = parseFloat(match[4]) * 0.01;
|
|
6698
|
-
} else {
|
|
6699
|
-
rgb[3] = parseFloat(match[4]);
|
|
6700
|
-
}
|
|
6648
|
+
rgb[3] = match[5] ? Number.parseFloat(match[4]) * 0.01 : Number.parseFloat(match[4]);
|
|
6701
6649
|
}
|
|
6702
6650
|
} else if (match = string.match(per)) {
|
|
6703
6651
|
for (i = 0; i < 3; i++) {
|
|
6704
|
-
rgb[i] = Math.round(parseFloat(match[i + 1]) * 2.55);
|
|
6652
|
+
rgb[i] = Math.round(Number.parseFloat(match[i + 1]) * 2.55);
|
|
6705
6653
|
}
|
|
6706
6654
|
if (match[4]) {
|
|
6707
|
-
|
|
6708
|
-
rgb[3] = parseFloat(match[4]) * 0.01;
|
|
6709
|
-
} else {
|
|
6710
|
-
rgb[3] = parseFloat(match[4]);
|
|
6711
|
-
}
|
|
6655
|
+
rgb[3] = match[5] ? Number.parseFloat(match[4]) * 0.01 : Number.parseFloat(match[4]);
|
|
6712
6656
|
}
|
|
6713
6657
|
} else if (match = string.match(keyword)) {
|
|
6714
6658
|
if (match[1] === "transparent") {
|
|
6715
6659
|
return [0, 0, 0, 0];
|
|
6716
6660
|
}
|
|
6717
|
-
if (!
|
|
6661
|
+
if (!Object.hasOwn(cssKeywords, match[1])) {
|
|
6718
6662
|
return null;
|
|
6719
6663
|
}
|
|
6720
|
-
rgb =
|
|
6664
|
+
rgb = cssKeywords[match[1]];
|
|
6721
6665
|
rgb[3] = 1;
|
|
6722
6666
|
return rgb;
|
|
6723
6667
|
} else {
|
|
@@ -6733,14 +6677,14 @@ var require_color_string = __commonJS({
|
|
|
6733
6677
|
if (!string) {
|
|
6734
6678
|
return null;
|
|
6735
6679
|
}
|
|
6736
|
-
|
|
6737
|
-
|
|
6680
|
+
const 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*)?\)$/;
|
|
6681
|
+
const match = string.match(hsl);
|
|
6738
6682
|
if (match) {
|
|
6739
|
-
|
|
6740
|
-
|
|
6741
|
-
|
|
6742
|
-
|
|
6743
|
-
|
|
6683
|
+
const alpha = Number.parseFloat(match[4]);
|
|
6684
|
+
const h = (Number.parseFloat(match[1]) % 360 + 360) % 360;
|
|
6685
|
+
const s = clamp3(Number.parseFloat(match[2]), 0, 100);
|
|
6686
|
+
const l = clamp3(Number.parseFloat(match[3]), 0, 100);
|
|
6687
|
+
const a = clamp3(Number.isNaN(alpha) ? 1 : alpha, 0, 1);
|
|
6744
6688
|
return [h, s, l, a];
|
|
6745
6689
|
}
|
|
6746
6690
|
return null;
|
|
@@ -6749,228 +6693,55 @@ var require_color_string = __commonJS({
|
|
|
6749
6693
|
if (!string) {
|
|
6750
6694
|
return null;
|
|
6751
6695
|
}
|
|
6752
|
-
|
|
6753
|
-
|
|
6696
|
+
const hwb = /^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*[\s,]\s*([+-]?[\d.]+)%\s*[\s,]\s*([+-]?[\d.]+)%\s*(?:[\s,]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/;
|
|
6697
|
+
const match = string.match(hwb);
|
|
6754
6698
|
if (match) {
|
|
6755
|
-
|
|
6756
|
-
|
|
6757
|
-
|
|
6758
|
-
|
|
6759
|
-
|
|
6699
|
+
const alpha = Number.parseFloat(match[4]);
|
|
6700
|
+
const h = (Number.parseFloat(match[1]) % 360 + 360) % 360;
|
|
6701
|
+
const w = clamp3(Number.parseFloat(match[2]), 0, 100);
|
|
6702
|
+
const b = clamp3(Number.parseFloat(match[3]), 0, 100);
|
|
6703
|
+
const a = clamp3(Number.isNaN(alpha) ? 1 : alpha, 0, 1);
|
|
6760
6704
|
return [h, w, b, a];
|
|
6761
6705
|
}
|
|
6762
6706
|
return null;
|
|
6763
6707
|
};
|
|
6764
|
-
cs.to.hex = function() {
|
|
6765
|
-
var rgba = swizzle(arguments);
|
|
6708
|
+
cs.to.hex = function(...rgba) {
|
|
6766
6709
|
return "#" + hexDouble(rgba[0]) + hexDouble(rgba[1]) + hexDouble(rgba[2]) + (rgba[3] < 1 ? hexDouble(Math.round(rgba[3] * 255)) : "");
|
|
6767
6710
|
};
|
|
6768
|
-
cs.to.rgb = function() {
|
|
6769
|
-
var rgba = swizzle(arguments);
|
|
6711
|
+
cs.to.rgb = function(...rgba) {
|
|
6770
6712
|
return rgba.length < 4 || rgba[3] === 1 ? "rgb(" + Math.round(rgba[0]) + ", " + Math.round(rgba[1]) + ", " + Math.round(rgba[2]) + ")" : "rgba(" + Math.round(rgba[0]) + ", " + Math.round(rgba[1]) + ", " + Math.round(rgba[2]) + ", " + rgba[3] + ")";
|
|
6771
6713
|
};
|
|
6772
|
-
cs.to.rgb.percent = function() {
|
|
6773
|
-
|
|
6774
|
-
|
|
6775
|
-
|
|
6776
|
-
var b = Math.round(rgba[2] / 255 * 100);
|
|
6714
|
+
cs.to.rgb.percent = function(...rgba) {
|
|
6715
|
+
const r = Math.round(rgba[0] / 255 * 100);
|
|
6716
|
+
const g = Math.round(rgba[1] / 255 * 100);
|
|
6717
|
+
const b = Math.round(rgba[2] / 255 * 100);
|
|
6777
6718
|
return rgba.length < 4 || rgba[3] === 1 ? "rgb(" + r + "%, " + g + "%, " + b + "%)" : "rgba(" + r + "%, " + g + "%, " + b + "%, " + rgba[3] + ")";
|
|
6778
6719
|
};
|
|
6779
|
-
cs.to.hsl = function() {
|
|
6780
|
-
var hsla = swizzle(arguments);
|
|
6720
|
+
cs.to.hsl = function(...hsla) {
|
|
6781
6721
|
return hsla.length < 4 || hsla[3] === 1 ? "hsl(" + hsla[0] + ", " + hsla[1] + "%, " + hsla[2] + "%)" : "hsla(" + hsla[0] + ", " + hsla[1] + "%, " + hsla[2] + "%, " + hsla[3] + ")";
|
|
6782
6722
|
};
|
|
6783
|
-
cs.to.hwb = function() {
|
|
6784
|
-
|
|
6785
|
-
var a = "";
|
|
6723
|
+
cs.to.hwb = function(...hwba) {
|
|
6724
|
+
let a = "";
|
|
6786
6725
|
if (hwba.length >= 4 && hwba[3] !== 1) {
|
|
6787
6726
|
a = ", " + hwba[3];
|
|
6788
6727
|
}
|
|
6789
6728
|
return "hwb(" + hwba[0] + ", " + hwba[1] + "%, " + hwba[2] + "%" + a + ")";
|
|
6790
6729
|
};
|
|
6791
|
-
cs.to.keyword = function(rgb) {
|
|
6730
|
+
cs.to.keyword = function(...rgb) {
|
|
6792
6731
|
return reverseNames[rgb.slice(0, 3)];
|
|
6793
6732
|
};
|
|
6794
|
-
function clamp3(
|
|
6795
|
-
return Math.min(Math.max(min,
|
|
6733
|
+
function clamp3(number_, min, max) {
|
|
6734
|
+
return Math.min(Math.max(min, number_), max);
|
|
6796
6735
|
}
|
|
6797
|
-
function hexDouble(
|
|
6798
|
-
|
|
6799
|
-
return
|
|
6736
|
+
function hexDouble(number_) {
|
|
6737
|
+
const string_ = Math.round(number_).toString(16).toUpperCase();
|
|
6738
|
+
return string_.length < 2 ? "0" + string_ : string_;
|
|
6800
6739
|
}
|
|
6801
|
-
}
|
|
6802
|
-
});
|
|
6803
|
-
|
|
6804
|
-
// ../../node_modules/color-convert/node_modules/color-name/index.js
|
|
6805
|
-
var require_color_name2 = __commonJS({
|
|
6806
|
-
"../../node_modules/color-convert/node_modules/color-name/index.js"(exports2, module2) {
|
|
6807
|
-
"use strict";
|
|
6808
|
-
module2.exports = {
|
|
6809
|
-
"aliceblue": [240, 248, 255],
|
|
6810
|
-
"antiquewhite": [250, 235, 215],
|
|
6811
|
-
"aqua": [0, 255, 255],
|
|
6812
|
-
"aquamarine": [127, 255, 212],
|
|
6813
|
-
"azure": [240, 255, 255],
|
|
6814
|
-
"beige": [245, 245, 220],
|
|
6815
|
-
"bisque": [255, 228, 196],
|
|
6816
|
-
"black": [0, 0, 0],
|
|
6817
|
-
"blanchedalmond": [255, 235, 205],
|
|
6818
|
-
"blue": [0, 0, 255],
|
|
6819
|
-
"blueviolet": [138, 43, 226],
|
|
6820
|
-
"brown": [165, 42, 42],
|
|
6821
|
-
"burlywood": [222, 184, 135],
|
|
6822
|
-
"cadetblue": [95, 158, 160],
|
|
6823
|
-
"chartreuse": [127, 255, 0],
|
|
6824
|
-
"chocolate": [210, 105, 30],
|
|
6825
|
-
"coral": [255, 127, 80],
|
|
6826
|
-
"cornflowerblue": [100, 149, 237],
|
|
6827
|
-
"cornsilk": [255, 248, 220],
|
|
6828
|
-
"crimson": [220, 20, 60],
|
|
6829
|
-
"cyan": [0, 255, 255],
|
|
6830
|
-
"darkblue": [0, 0, 139],
|
|
6831
|
-
"darkcyan": [0, 139, 139],
|
|
6832
|
-
"darkgoldenrod": [184, 134, 11],
|
|
6833
|
-
"darkgray": [169, 169, 169],
|
|
6834
|
-
"darkgreen": [0, 100, 0],
|
|
6835
|
-
"darkgrey": [169, 169, 169],
|
|
6836
|
-
"darkkhaki": [189, 183, 107],
|
|
6837
|
-
"darkmagenta": [139, 0, 139],
|
|
6838
|
-
"darkolivegreen": [85, 107, 47],
|
|
6839
|
-
"darkorange": [255, 140, 0],
|
|
6840
|
-
"darkorchid": [153, 50, 204],
|
|
6841
|
-
"darkred": [139, 0, 0],
|
|
6842
|
-
"darksalmon": [233, 150, 122],
|
|
6843
|
-
"darkseagreen": [143, 188, 143],
|
|
6844
|
-
"darkslateblue": [72, 61, 139],
|
|
6845
|
-
"darkslategray": [47, 79, 79],
|
|
6846
|
-
"darkslategrey": [47, 79, 79],
|
|
6847
|
-
"darkturquoise": [0, 206, 209],
|
|
6848
|
-
"darkviolet": [148, 0, 211],
|
|
6849
|
-
"deeppink": [255, 20, 147],
|
|
6850
|
-
"deepskyblue": [0, 191, 255],
|
|
6851
|
-
"dimgray": [105, 105, 105],
|
|
6852
|
-
"dimgrey": [105, 105, 105],
|
|
6853
|
-
"dodgerblue": [30, 144, 255],
|
|
6854
|
-
"firebrick": [178, 34, 34],
|
|
6855
|
-
"floralwhite": [255, 250, 240],
|
|
6856
|
-
"forestgreen": [34, 139, 34],
|
|
6857
|
-
"fuchsia": [255, 0, 255],
|
|
6858
|
-
"gainsboro": [220, 220, 220],
|
|
6859
|
-
"ghostwhite": [248, 248, 255],
|
|
6860
|
-
"gold": [255, 215, 0],
|
|
6861
|
-
"goldenrod": [218, 165, 32],
|
|
6862
|
-
"gray": [128, 128, 128],
|
|
6863
|
-
"green": [0, 128, 0],
|
|
6864
|
-
"greenyellow": [173, 255, 47],
|
|
6865
|
-
"grey": [128, 128, 128],
|
|
6866
|
-
"honeydew": [240, 255, 240],
|
|
6867
|
-
"hotpink": [255, 105, 180],
|
|
6868
|
-
"indianred": [205, 92, 92],
|
|
6869
|
-
"indigo": [75, 0, 130],
|
|
6870
|
-
"ivory": [255, 255, 240],
|
|
6871
|
-
"khaki": [240, 230, 140],
|
|
6872
|
-
"lavender": [230, 230, 250],
|
|
6873
|
-
"lavenderblush": [255, 240, 245],
|
|
6874
|
-
"lawngreen": [124, 252, 0],
|
|
6875
|
-
"lemonchiffon": [255, 250, 205],
|
|
6876
|
-
"lightblue": [173, 216, 230],
|
|
6877
|
-
"lightcoral": [240, 128, 128],
|
|
6878
|
-
"lightcyan": [224, 255, 255],
|
|
6879
|
-
"lightgoldenrodyellow": [250, 250, 210],
|
|
6880
|
-
"lightgray": [211, 211, 211],
|
|
6881
|
-
"lightgreen": [144, 238, 144],
|
|
6882
|
-
"lightgrey": [211, 211, 211],
|
|
6883
|
-
"lightpink": [255, 182, 193],
|
|
6884
|
-
"lightsalmon": [255, 160, 122],
|
|
6885
|
-
"lightseagreen": [32, 178, 170],
|
|
6886
|
-
"lightskyblue": [135, 206, 250],
|
|
6887
|
-
"lightslategray": [119, 136, 153],
|
|
6888
|
-
"lightslategrey": [119, 136, 153],
|
|
6889
|
-
"lightsteelblue": [176, 196, 222],
|
|
6890
|
-
"lightyellow": [255, 255, 224],
|
|
6891
|
-
"lime": [0, 255, 0],
|
|
6892
|
-
"limegreen": [50, 205, 50],
|
|
6893
|
-
"linen": [250, 240, 230],
|
|
6894
|
-
"magenta": [255, 0, 255],
|
|
6895
|
-
"maroon": [128, 0, 0],
|
|
6896
|
-
"mediumaquamarine": [102, 205, 170],
|
|
6897
|
-
"mediumblue": [0, 0, 205],
|
|
6898
|
-
"mediumorchid": [186, 85, 211],
|
|
6899
|
-
"mediumpurple": [147, 112, 219],
|
|
6900
|
-
"mediumseagreen": [60, 179, 113],
|
|
6901
|
-
"mediumslateblue": [123, 104, 238],
|
|
6902
|
-
"mediumspringgreen": [0, 250, 154],
|
|
6903
|
-
"mediumturquoise": [72, 209, 204],
|
|
6904
|
-
"mediumvioletred": [199, 21, 133],
|
|
6905
|
-
"midnightblue": [25, 25, 112],
|
|
6906
|
-
"mintcream": [245, 255, 250],
|
|
6907
|
-
"mistyrose": [255, 228, 225],
|
|
6908
|
-
"moccasin": [255, 228, 181],
|
|
6909
|
-
"navajowhite": [255, 222, 173],
|
|
6910
|
-
"navy": [0, 0, 128],
|
|
6911
|
-
"oldlace": [253, 245, 230],
|
|
6912
|
-
"olive": [128, 128, 0],
|
|
6913
|
-
"olivedrab": [107, 142, 35],
|
|
6914
|
-
"orange": [255, 165, 0],
|
|
6915
|
-
"orangered": [255, 69, 0],
|
|
6916
|
-
"orchid": [218, 112, 214],
|
|
6917
|
-
"palegoldenrod": [238, 232, 170],
|
|
6918
|
-
"palegreen": [152, 251, 152],
|
|
6919
|
-
"paleturquoise": [175, 238, 238],
|
|
6920
|
-
"palevioletred": [219, 112, 147],
|
|
6921
|
-
"papayawhip": [255, 239, 213],
|
|
6922
|
-
"peachpuff": [255, 218, 185],
|
|
6923
|
-
"peru": [205, 133, 63],
|
|
6924
|
-
"pink": [255, 192, 203],
|
|
6925
|
-
"plum": [221, 160, 221],
|
|
6926
|
-
"powderblue": [176, 224, 230],
|
|
6927
|
-
"purple": [128, 0, 128],
|
|
6928
|
-
"rebeccapurple": [102, 51, 153],
|
|
6929
|
-
"red": [255, 0, 0],
|
|
6930
|
-
"rosybrown": [188, 143, 143],
|
|
6931
|
-
"royalblue": [65, 105, 225],
|
|
6932
|
-
"saddlebrown": [139, 69, 19],
|
|
6933
|
-
"salmon": [250, 128, 114],
|
|
6934
|
-
"sandybrown": [244, 164, 96],
|
|
6935
|
-
"seagreen": [46, 139, 87],
|
|
6936
|
-
"seashell": [255, 245, 238],
|
|
6937
|
-
"sienna": [160, 82, 45],
|
|
6938
|
-
"silver": [192, 192, 192],
|
|
6939
|
-
"skyblue": [135, 206, 235],
|
|
6940
|
-
"slateblue": [106, 90, 205],
|
|
6941
|
-
"slategray": [112, 128, 144],
|
|
6942
|
-
"slategrey": [112, 128, 144],
|
|
6943
|
-
"snow": [255, 250, 250],
|
|
6944
|
-
"springgreen": [0, 255, 127],
|
|
6945
|
-
"steelblue": [70, 130, 180],
|
|
6946
|
-
"tan": [210, 180, 140],
|
|
6947
|
-
"teal": [0, 128, 128],
|
|
6948
|
-
"thistle": [216, 191, 216],
|
|
6949
|
-
"tomato": [255, 99, 71],
|
|
6950
|
-
"turquoise": [64, 224, 208],
|
|
6951
|
-
"violet": [238, 130, 238],
|
|
6952
|
-
"wheat": [245, 222, 179],
|
|
6953
|
-
"white": [255, 255, 255],
|
|
6954
|
-
"whitesmoke": [245, 245, 245],
|
|
6955
|
-
"yellow": [255, 255, 0],
|
|
6956
|
-
"yellowgreen": [154, 205, 50]
|
|
6957
|
-
};
|
|
6958
|
-
}
|
|
6959
|
-
});
|
|
6960
|
-
|
|
6961
|
-
// ../../node_modules/color-convert/conversions.js
|
|
6962
|
-
var require_conversions = __commonJS({
|
|
6963
|
-
"../../node_modules/color-convert/conversions.js"(exports2, module2) {
|
|
6964
|
-
"use strict";
|
|
6965
|
-
var cssKeywords = require_color_name2();
|
|
6966
6740
|
var reverseKeywords = {};
|
|
6967
|
-
for (key
|
|
6968
|
-
|
|
6969
|
-
reverseKeywords[cssKeywords[key]] = key;
|
|
6970
|
-
}
|
|
6741
|
+
for (const key of Object.keys(cssKeywords)) {
|
|
6742
|
+
reverseKeywords[cssKeywords[key]] = key;
|
|
6971
6743
|
}
|
|
6972
|
-
var
|
|
6973
|
-
var convert = module2.exports = {
|
|
6744
|
+
var convert$1 = {
|
|
6974
6745
|
rgb: { channels: 3, labels: "rgb" },
|
|
6975
6746
|
hsl: { channels: 3, labels: "hsl" },
|
|
6976
6747
|
hsv: { channels: 3, labels: "hsv" },
|
|
@@ -6978,7 +6749,9 @@ var require_conversions = __commonJS({
|
|
|
6978
6749
|
cmyk: { channels: 4, labels: "cmyk" },
|
|
6979
6750
|
xyz: { channels: 3, labels: "xyz" },
|
|
6980
6751
|
lab: { channels: 3, labels: "lab" },
|
|
6752
|
+
oklab: { channels: 3, labels: ["okl", "oka", "okb"] },
|
|
6981
6753
|
lch: { channels: 3, labels: "lch" },
|
|
6754
|
+
oklch: { channels: 3, labels: ["okl", "okc", "okh"] },
|
|
6982
6755
|
hex: { channels: 1, labels: ["hex"] },
|
|
6983
6756
|
keyword: { channels: 1, labels: ["keyword"] },
|
|
6984
6757
|
ansi16: { channels: 1, labels: ["ansi16"] },
|
|
@@ -6987,52 +6760,62 @@ var require_conversions = __commonJS({
|
|
|
6987
6760
|
apple: { channels: 3, labels: ["r16", "g16", "b16"] },
|
|
6988
6761
|
gray: { channels: 1, labels: ["gray"] }
|
|
6989
6762
|
};
|
|
6990
|
-
|
|
6991
|
-
|
|
6992
|
-
|
|
6993
|
-
|
|
6994
|
-
|
|
6995
|
-
|
|
6996
|
-
|
|
6997
|
-
|
|
6998
|
-
|
|
6999
|
-
|
|
7000
|
-
|
|
7001
|
-
|
|
7002
|
-
|
|
7003
|
-
|
|
7004
|
-
|
|
7005
|
-
|
|
7006
|
-
|
|
7007
|
-
}
|
|
7008
|
-
|
|
7009
|
-
|
|
7010
|
-
|
|
7011
|
-
|
|
7012
|
-
|
|
7013
|
-
|
|
7014
|
-
|
|
7015
|
-
|
|
7016
|
-
|
|
7017
|
-
|
|
7018
|
-
|
|
7019
|
-
|
|
7020
|
-
|
|
7021
|
-
|
|
7022
|
-
|
|
7023
|
-
|
|
7024
|
-
|
|
7025
|
-
|
|
7026
|
-
|
|
7027
|
-
|
|
7028
|
-
|
|
7029
|
-
|
|
6763
|
+
var LAB_FT = (6 / 29) ** 3;
|
|
6764
|
+
function srgbNonlinearTransform(c) {
|
|
6765
|
+
const cc = c > 31308e-7 ? 1.055 * c ** (1 / 2.4) - 0.055 : c * 12.92;
|
|
6766
|
+
return Math.min(Math.max(0, cc), 1);
|
|
6767
|
+
}
|
|
6768
|
+
function srgbNonlinearTransformInv(c) {
|
|
6769
|
+
return c > 0.04045 ? ((c + 0.055) / 1.055) ** 2.4 : c / 12.92;
|
|
6770
|
+
}
|
|
6771
|
+
for (const model of Object.keys(convert$1)) {
|
|
6772
|
+
if (!("channels" in convert$1[model])) {
|
|
6773
|
+
throw new Error("missing channels property: " + model);
|
|
6774
|
+
}
|
|
6775
|
+
if (!("labels" in convert$1[model])) {
|
|
6776
|
+
throw new Error("missing channel labels property: " + model);
|
|
6777
|
+
}
|
|
6778
|
+
if (convert$1[model].labels.length !== convert$1[model].channels) {
|
|
6779
|
+
throw new Error("channel and label counts mismatch: " + model);
|
|
6780
|
+
}
|
|
6781
|
+
const { channels, labels } = convert$1[model];
|
|
6782
|
+
delete convert$1[model].channels;
|
|
6783
|
+
delete convert$1[model].labels;
|
|
6784
|
+
Object.defineProperty(convert$1[model], "channels", { value: channels });
|
|
6785
|
+
Object.defineProperty(convert$1[model], "labels", { value: labels });
|
|
6786
|
+
}
|
|
6787
|
+
convert$1.rgb.hsl = function(rgb) {
|
|
6788
|
+
const r = rgb[0] / 255;
|
|
6789
|
+
const g = rgb[1] / 255;
|
|
6790
|
+
const b = rgb[2] / 255;
|
|
6791
|
+
const min = Math.min(r, g, b);
|
|
6792
|
+
const max = Math.max(r, g, b);
|
|
6793
|
+
const delta = max - min;
|
|
6794
|
+
let h;
|
|
6795
|
+
let s;
|
|
6796
|
+
switch (max) {
|
|
6797
|
+
case min: {
|
|
6798
|
+
h = 0;
|
|
6799
|
+
break;
|
|
6800
|
+
}
|
|
6801
|
+
case r: {
|
|
6802
|
+
h = (g - b) / delta;
|
|
6803
|
+
break;
|
|
6804
|
+
}
|
|
6805
|
+
case g: {
|
|
6806
|
+
h = 2 + (b - r) / delta;
|
|
6807
|
+
break;
|
|
6808
|
+
}
|
|
6809
|
+
case b: {
|
|
6810
|
+
h = 4 + (r - g) / delta;
|
|
6811
|
+
break;
|
|
6812
|
+
}
|
|
7030
6813
|
}
|
|
7031
6814
|
h = Math.min(h * 60, 360);
|
|
7032
6815
|
if (h < 0) {
|
|
7033
6816
|
h += 360;
|
|
7034
6817
|
}
|
|
7035
|
-
l = (min + max) / 2;
|
|
6818
|
+
const l = (min + max) / 2;
|
|
7036
6819
|
if (max === min) {
|
|
7037
6820
|
s = 0;
|
|
7038
6821
|
} else if (l <= 0.5) {
|
|
@@ -7042,33 +6825,41 @@ var require_conversions = __commonJS({
|
|
|
7042
6825
|
}
|
|
7043
6826
|
return [h, s * 100, l * 100];
|
|
7044
6827
|
};
|
|
7045
|
-
convert.rgb.hsv = function(rgb) {
|
|
7046
|
-
|
|
7047
|
-
|
|
7048
|
-
|
|
7049
|
-
|
|
7050
|
-
|
|
7051
|
-
|
|
7052
|
-
|
|
7053
|
-
|
|
7054
|
-
|
|
7055
|
-
|
|
7056
|
-
|
|
6828
|
+
convert$1.rgb.hsv = function(rgb) {
|
|
6829
|
+
let rdif;
|
|
6830
|
+
let gdif;
|
|
6831
|
+
let bdif;
|
|
6832
|
+
let h;
|
|
6833
|
+
let s;
|
|
6834
|
+
const r = rgb[0] / 255;
|
|
6835
|
+
const g = rgb[1] / 255;
|
|
6836
|
+
const b = rgb[2] / 255;
|
|
6837
|
+
const v = Math.max(r, g, b);
|
|
6838
|
+
const diff = v - Math.min(r, g, b);
|
|
6839
|
+
const diffc = function(c) {
|
|
7057
6840
|
return (v - c) / 6 / diff + 1 / 2;
|
|
7058
6841
|
};
|
|
7059
6842
|
if (diff === 0) {
|
|
7060
|
-
h =
|
|
6843
|
+
h = 0;
|
|
6844
|
+
s = 0;
|
|
7061
6845
|
} else {
|
|
7062
6846
|
s = diff / v;
|
|
7063
6847
|
rdif = diffc(r);
|
|
7064
6848
|
gdif = diffc(g);
|
|
7065
6849
|
bdif = diffc(b);
|
|
7066
|
-
|
|
7067
|
-
|
|
7068
|
-
|
|
7069
|
-
|
|
7070
|
-
|
|
7071
|
-
|
|
6850
|
+
switch (v) {
|
|
6851
|
+
case r: {
|
|
6852
|
+
h = bdif - gdif;
|
|
6853
|
+
break;
|
|
6854
|
+
}
|
|
6855
|
+
case g: {
|
|
6856
|
+
h = 1 / 3 + rdif - bdif;
|
|
6857
|
+
break;
|
|
6858
|
+
}
|
|
6859
|
+
case b: {
|
|
6860
|
+
h = 2 / 3 + gdif - rdif;
|
|
6861
|
+
break;
|
|
6862
|
+
}
|
|
7072
6863
|
}
|
|
7073
6864
|
if (h < 0) {
|
|
7074
6865
|
h += 1;
|
|
@@ -7082,106 +6873,99 @@ var require_conversions = __commonJS({
|
|
|
7082
6873
|
v * 100
|
|
7083
6874
|
];
|
|
7084
6875
|
};
|
|
7085
|
-
convert.rgb.hwb = function(rgb) {
|
|
7086
|
-
|
|
7087
|
-
|
|
7088
|
-
|
|
7089
|
-
|
|
7090
|
-
|
|
6876
|
+
convert$1.rgb.hwb = function(rgb) {
|
|
6877
|
+
const r = rgb[0];
|
|
6878
|
+
const g = rgb[1];
|
|
6879
|
+
let b = rgb[2];
|
|
6880
|
+
const h = convert$1.rgb.hsl(rgb)[0];
|
|
6881
|
+
const w = 1 / 255 * Math.min(r, Math.min(g, b));
|
|
7091
6882
|
b = 1 - 1 / 255 * Math.max(r, Math.max(g, b));
|
|
7092
6883
|
return [h, w * 100, b * 100];
|
|
7093
6884
|
};
|
|
7094
|
-
convert.rgb.
|
|
7095
|
-
|
|
7096
|
-
|
|
7097
|
-
|
|
7098
|
-
|
|
7099
|
-
|
|
7100
|
-
|
|
7101
|
-
|
|
7102
|
-
|
|
7103
|
-
|
|
7104
|
-
|
|
7105
|
-
|
|
6885
|
+
convert$1.rgb.oklab = function(rgb) {
|
|
6886
|
+
const r = srgbNonlinearTransformInv(rgb[0] / 255);
|
|
6887
|
+
const g = srgbNonlinearTransformInv(rgb[1] / 255);
|
|
6888
|
+
const b = srgbNonlinearTransformInv(rgb[2] / 255);
|
|
6889
|
+
const lp = Math.cbrt(0.4122214708 * r + 0.5363325363 * g + 0.0514459929 * b);
|
|
6890
|
+
const mp = Math.cbrt(0.2119034982 * r + 0.6806995451 * g + 0.1073969566 * b);
|
|
6891
|
+
const sp = Math.cbrt(0.0883024619 * r + 0.2817188376 * g + 0.6299787005 * b);
|
|
6892
|
+
const l = 0.2104542553 * lp + 0.793617785 * mp - 0.0040720468 * sp;
|
|
6893
|
+
const aa = 1.9779984951 * lp - 2.428592205 * mp + 0.4505937099 * sp;
|
|
6894
|
+
const bb = 0.0259040371 * lp + 0.7827717662 * mp - 0.808675766 * sp;
|
|
6895
|
+
return [l * 100, aa * 100, bb * 100];
|
|
6896
|
+
};
|
|
6897
|
+
convert$1.rgb.cmyk = function(rgb) {
|
|
6898
|
+
const r = rgb[0] / 255;
|
|
6899
|
+
const g = rgb[1] / 255;
|
|
6900
|
+
const b = rgb[2] / 255;
|
|
6901
|
+
const k = Math.min(1 - r, 1 - g, 1 - b);
|
|
6902
|
+
const c = (1 - r - k) / (1 - k) || 0;
|
|
6903
|
+
const m = (1 - g - k) / (1 - k) || 0;
|
|
6904
|
+
const y = (1 - b - k) / (1 - k) || 0;
|
|
7106
6905
|
return [c * 100, m * 100, y * 100, k * 100];
|
|
7107
6906
|
};
|
|
7108
6907
|
function comparativeDistance(x, y) {
|
|
7109
|
-
return
|
|
6908
|
+
return (x[0] - y[0]) ** 2 + (x[1] - y[1]) ** 2 + (x[2] - y[2]) ** 2;
|
|
7110
6909
|
}
|
|
7111
|
-
convert.rgb.keyword = function(rgb) {
|
|
7112
|
-
|
|
6910
|
+
convert$1.rgb.keyword = function(rgb) {
|
|
6911
|
+
const reversed = reverseKeywords[rgb];
|
|
7113
6912
|
if (reversed) {
|
|
7114
6913
|
return reversed;
|
|
7115
6914
|
}
|
|
7116
|
-
|
|
7117
|
-
|
|
7118
|
-
for (
|
|
7119
|
-
|
|
7120
|
-
|
|
7121
|
-
|
|
7122
|
-
|
|
7123
|
-
|
|
7124
|
-
currentClosestKeyword = keyword;
|
|
7125
|
-
}
|
|
6915
|
+
let currentClosestDistance = Number.POSITIVE_INFINITY;
|
|
6916
|
+
let currentClosestKeyword;
|
|
6917
|
+
for (const keyword of Object.keys(cssKeywords)) {
|
|
6918
|
+
const value = cssKeywords[keyword];
|
|
6919
|
+
const distance = comparativeDistance(rgb, value);
|
|
6920
|
+
if (distance < currentClosestDistance) {
|
|
6921
|
+
currentClosestDistance = distance;
|
|
6922
|
+
currentClosestKeyword = keyword;
|
|
7126
6923
|
}
|
|
7127
6924
|
}
|
|
7128
6925
|
return currentClosestKeyword;
|
|
7129
6926
|
};
|
|
7130
|
-
convert.keyword.rgb = function(keyword) {
|
|
6927
|
+
convert$1.keyword.rgb = function(keyword) {
|
|
7131
6928
|
return cssKeywords[keyword];
|
|
7132
6929
|
};
|
|
7133
|
-
convert.rgb.xyz = function(rgb) {
|
|
7134
|
-
|
|
7135
|
-
|
|
7136
|
-
|
|
7137
|
-
|
|
7138
|
-
|
|
7139
|
-
|
|
7140
|
-
var x = r * 0.4124 + g * 0.3576 + b * 0.1805;
|
|
7141
|
-
var y = r * 0.2126 + g * 0.7152 + b * 0.0722;
|
|
7142
|
-
var z = r * 0.0193 + g * 0.1192 + b * 0.9505;
|
|
6930
|
+
convert$1.rgb.xyz = function(rgb) {
|
|
6931
|
+
const r = srgbNonlinearTransformInv(rgb[0] / 255);
|
|
6932
|
+
const g = srgbNonlinearTransformInv(rgb[1] / 255);
|
|
6933
|
+
const b = srgbNonlinearTransformInv(rgb[2] / 255);
|
|
6934
|
+
const x = r * 0.4124564 + g * 0.3575761 + b * 0.1804375;
|
|
6935
|
+
const y = r * 0.2126729 + g * 0.7151522 + b * 0.072175;
|
|
6936
|
+
const z = r * 0.0193339 + g * 0.119192 + b * 0.9503041;
|
|
7143
6937
|
return [x * 100, y * 100, z * 100];
|
|
7144
6938
|
};
|
|
7145
|
-
convert.rgb.lab = function(rgb) {
|
|
7146
|
-
|
|
7147
|
-
|
|
7148
|
-
|
|
7149
|
-
|
|
7150
|
-
var l;
|
|
7151
|
-
var a;
|
|
7152
|
-
var b;
|
|
6939
|
+
convert$1.rgb.lab = function(rgb) {
|
|
6940
|
+
const xyz = convert$1.rgb.xyz(rgb);
|
|
6941
|
+
let x = xyz[0];
|
|
6942
|
+
let y = xyz[1];
|
|
6943
|
+
let z = xyz[2];
|
|
7153
6944
|
x /= 95.047;
|
|
7154
6945
|
y /= 100;
|
|
7155
6946
|
z /= 108.883;
|
|
7156
|
-
x = x >
|
|
7157
|
-
y = y >
|
|
7158
|
-
z = z >
|
|
7159
|
-
l = 116 * y - 16;
|
|
7160
|
-
a = 500 * (x - y);
|
|
7161
|
-
b = 200 * (y - z);
|
|
6947
|
+
x = x > LAB_FT ? x ** (1 / 3) : 7.787 * x + 16 / 116;
|
|
6948
|
+
y = y > LAB_FT ? y ** (1 / 3) : 7.787 * y + 16 / 116;
|
|
6949
|
+
z = z > LAB_FT ? z ** (1 / 3) : 7.787 * z + 16 / 116;
|
|
6950
|
+
const l = 116 * y - 16;
|
|
6951
|
+
const a = 500 * (x - y);
|
|
6952
|
+
const b = 200 * (y - z);
|
|
7162
6953
|
return [l, a, b];
|
|
7163
6954
|
};
|
|
7164
|
-
convert.hsl.rgb = function(hsl) {
|
|
7165
|
-
|
|
7166
|
-
|
|
7167
|
-
|
|
7168
|
-
|
|
7169
|
-
|
|
7170
|
-
var t3;
|
|
7171
|
-
var rgb;
|
|
7172
|
-
var val;
|
|
6955
|
+
convert$1.hsl.rgb = function(hsl) {
|
|
6956
|
+
const h = hsl[0] / 360;
|
|
6957
|
+
const s = hsl[1] / 100;
|
|
6958
|
+
const l = hsl[2] / 100;
|
|
6959
|
+
let t3;
|
|
6960
|
+
let value;
|
|
7173
6961
|
if (s === 0) {
|
|
7174
|
-
|
|
7175
|
-
return [
|
|
6962
|
+
value = l * 255;
|
|
6963
|
+
return [value, value, value];
|
|
7176
6964
|
}
|
|
7177
|
-
|
|
7178
|
-
|
|
7179
|
-
|
|
7180
|
-
|
|
7181
|
-
}
|
|
7182
|
-
t1 = 2 * l - t2;
|
|
7183
|
-
rgb = [0, 0, 0];
|
|
7184
|
-
for (var i = 0; i < 3; i++) {
|
|
6965
|
+
const t2 = l < 0.5 ? l * (1 + s) : l + s - l * s;
|
|
6966
|
+
const t1 = 2 * l - t2;
|
|
6967
|
+
const rgb = [0, 0, 0];
|
|
6968
|
+
for (let i = 0; i < 3; i++) {
|
|
7185
6969
|
t3 = h + 1 / 3 * -(i - 1);
|
|
7186
6970
|
if (t3 < 0) {
|
|
7187
6971
|
t3++;
|
|
@@ -7190,253 +6974,285 @@ var require_conversions = __commonJS({
|
|
|
7190
6974
|
t3--;
|
|
7191
6975
|
}
|
|
7192
6976
|
if (6 * t3 < 1) {
|
|
7193
|
-
|
|
6977
|
+
value = t1 + (t2 - t1) * 6 * t3;
|
|
7194
6978
|
} else if (2 * t3 < 1) {
|
|
7195
|
-
|
|
6979
|
+
value = t2;
|
|
7196
6980
|
} else if (3 * t3 < 2) {
|
|
7197
|
-
|
|
6981
|
+
value = t1 + (t2 - t1) * (2 / 3 - t3) * 6;
|
|
7198
6982
|
} else {
|
|
7199
|
-
|
|
6983
|
+
value = t1;
|
|
7200
6984
|
}
|
|
7201
|
-
rgb[i] =
|
|
6985
|
+
rgb[i] = value * 255;
|
|
7202
6986
|
}
|
|
7203
6987
|
return rgb;
|
|
7204
6988
|
};
|
|
7205
|
-
convert.hsl.hsv = function(hsl) {
|
|
7206
|
-
|
|
7207
|
-
|
|
7208
|
-
|
|
7209
|
-
|
|
7210
|
-
|
|
7211
|
-
var sv;
|
|
7212
|
-
var v;
|
|
6989
|
+
convert$1.hsl.hsv = function(hsl) {
|
|
6990
|
+
const h = hsl[0];
|
|
6991
|
+
let s = hsl[1] / 100;
|
|
6992
|
+
let l = hsl[2] / 100;
|
|
6993
|
+
let smin = s;
|
|
6994
|
+
const lmin = Math.max(l, 0.01);
|
|
7213
6995
|
l *= 2;
|
|
7214
6996
|
s *= l <= 1 ? l : 2 - l;
|
|
7215
6997
|
smin *= lmin <= 1 ? lmin : 2 - lmin;
|
|
7216
|
-
v = (l + s) / 2;
|
|
7217
|
-
sv = l === 0 ? 2 * smin / (lmin + smin) : 2 * s / (l + s);
|
|
6998
|
+
const v = (l + s) / 2;
|
|
6999
|
+
const sv = l === 0 ? 2 * smin / (lmin + smin) : 2 * s / (l + s);
|
|
7218
7000
|
return [h, sv * 100, v * 100];
|
|
7219
7001
|
};
|
|
7220
|
-
convert.hsv.rgb = function(hsv) {
|
|
7221
|
-
|
|
7222
|
-
|
|
7223
|
-
|
|
7224
|
-
|
|
7225
|
-
|
|
7226
|
-
|
|
7227
|
-
|
|
7228
|
-
|
|
7002
|
+
convert$1.hsv.rgb = function(hsv) {
|
|
7003
|
+
const h = hsv[0] / 60;
|
|
7004
|
+
const s = hsv[1] / 100;
|
|
7005
|
+
let v = hsv[2] / 100;
|
|
7006
|
+
const hi = Math.floor(h) % 6;
|
|
7007
|
+
const f = h - Math.floor(h);
|
|
7008
|
+
const p = 255 * v * (1 - s);
|
|
7009
|
+
const q = 255 * v * (1 - s * f);
|
|
7010
|
+
const t = 255 * v * (1 - s * (1 - f));
|
|
7229
7011
|
v *= 255;
|
|
7230
7012
|
switch (hi) {
|
|
7231
|
-
case 0:
|
|
7013
|
+
case 0: {
|
|
7232
7014
|
return [v, t, p];
|
|
7233
|
-
|
|
7015
|
+
}
|
|
7016
|
+
case 1: {
|
|
7234
7017
|
return [q, v, p];
|
|
7235
|
-
|
|
7018
|
+
}
|
|
7019
|
+
case 2: {
|
|
7236
7020
|
return [p, v, t];
|
|
7237
|
-
|
|
7021
|
+
}
|
|
7022
|
+
case 3: {
|
|
7238
7023
|
return [p, q, v];
|
|
7239
|
-
|
|
7024
|
+
}
|
|
7025
|
+
case 4: {
|
|
7240
7026
|
return [t, p, v];
|
|
7241
|
-
|
|
7027
|
+
}
|
|
7028
|
+
case 5: {
|
|
7242
7029
|
return [v, p, q];
|
|
7030
|
+
}
|
|
7243
7031
|
}
|
|
7244
7032
|
};
|
|
7245
|
-
convert.hsv.hsl = function(hsv) {
|
|
7246
|
-
|
|
7247
|
-
|
|
7248
|
-
|
|
7249
|
-
|
|
7250
|
-
|
|
7251
|
-
|
|
7252
|
-
var l;
|
|
7033
|
+
convert$1.hsv.hsl = function(hsv) {
|
|
7034
|
+
const h = hsv[0];
|
|
7035
|
+
const s = hsv[1] / 100;
|
|
7036
|
+
const v = hsv[2] / 100;
|
|
7037
|
+
const vmin = Math.max(v, 0.01);
|
|
7038
|
+
let sl;
|
|
7039
|
+
let l;
|
|
7253
7040
|
l = (2 - s) * v;
|
|
7254
|
-
lmin = (2 - s) * vmin;
|
|
7041
|
+
const lmin = (2 - s) * vmin;
|
|
7255
7042
|
sl = s * vmin;
|
|
7256
7043
|
sl /= lmin <= 1 ? lmin : 2 - lmin;
|
|
7257
7044
|
sl = sl || 0;
|
|
7258
7045
|
l /= 2;
|
|
7259
7046
|
return [h, sl * 100, l * 100];
|
|
7260
7047
|
};
|
|
7261
|
-
convert.hwb.rgb = function(hwb) {
|
|
7262
|
-
|
|
7263
|
-
|
|
7264
|
-
|
|
7265
|
-
|
|
7266
|
-
|
|
7267
|
-
var v;
|
|
7268
|
-
var f;
|
|
7269
|
-
var n;
|
|
7048
|
+
convert$1.hwb.rgb = function(hwb) {
|
|
7049
|
+
const h = hwb[0] / 360;
|
|
7050
|
+
let wh = hwb[1] / 100;
|
|
7051
|
+
let bl = hwb[2] / 100;
|
|
7052
|
+
const ratio = wh + bl;
|
|
7053
|
+
let f;
|
|
7270
7054
|
if (ratio > 1) {
|
|
7271
7055
|
wh /= ratio;
|
|
7272
7056
|
bl /= ratio;
|
|
7273
7057
|
}
|
|
7274
|
-
i = Math.floor(6 * h);
|
|
7275
|
-
v = 1 - bl;
|
|
7058
|
+
const i = Math.floor(6 * h);
|
|
7059
|
+
const v = 1 - bl;
|
|
7276
7060
|
f = 6 * h - i;
|
|
7277
7061
|
if ((i & 1) !== 0) {
|
|
7278
7062
|
f = 1 - f;
|
|
7279
7063
|
}
|
|
7280
|
-
n = wh + f * (v - wh);
|
|
7281
|
-
|
|
7282
|
-
|
|
7283
|
-
|
|
7064
|
+
const n = wh + f * (v - wh);
|
|
7065
|
+
let r;
|
|
7066
|
+
let g;
|
|
7067
|
+
let b;
|
|
7284
7068
|
switch (i) {
|
|
7285
7069
|
default:
|
|
7286
7070
|
case 6:
|
|
7287
|
-
case 0:
|
|
7071
|
+
case 0: {
|
|
7288
7072
|
r = v;
|
|
7289
7073
|
g = n;
|
|
7290
7074
|
b = wh;
|
|
7291
7075
|
break;
|
|
7292
|
-
|
|
7076
|
+
}
|
|
7077
|
+
case 1: {
|
|
7293
7078
|
r = n;
|
|
7294
7079
|
g = v;
|
|
7295
7080
|
b = wh;
|
|
7296
7081
|
break;
|
|
7297
|
-
|
|
7082
|
+
}
|
|
7083
|
+
case 2: {
|
|
7298
7084
|
r = wh;
|
|
7299
7085
|
g = v;
|
|
7300
7086
|
b = n;
|
|
7301
7087
|
break;
|
|
7302
|
-
|
|
7088
|
+
}
|
|
7089
|
+
case 3: {
|
|
7303
7090
|
r = wh;
|
|
7304
7091
|
g = n;
|
|
7305
7092
|
b = v;
|
|
7306
7093
|
break;
|
|
7307
|
-
|
|
7094
|
+
}
|
|
7095
|
+
case 4: {
|
|
7308
7096
|
r = n;
|
|
7309
7097
|
g = wh;
|
|
7310
7098
|
b = v;
|
|
7311
7099
|
break;
|
|
7312
|
-
|
|
7100
|
+
}
|
|
7101
|
+
case 5: {
|
|
7313
7102
|
r = v;
|
|
7314
7103
|
g = wh;
|
|
7315
7104
|
b = n;
|
|
7316
7105
|
break;
|
|
7106
|
+
}
|
|
7317
7107
|
}
|
|
7318
7108
|
return [r * 255, g * 255, b * 255];
|
|
7319
7109
|
};
|
|
7320
|
-
convert.cmyk.rgb = function(cmyk) {
|
|
7321
|
-
|
|
7322
|
-
|
|
7323
|
-
|
|
7324
|
-
|
|
7325
|
-
|
|
7326
|
-
|
|
7327
|
-
|
|
7328
|
-
r = 1 - Math.min(1, c * (1 - k) + k);
|
|
7329
|
-
g = 1 - Math.min(1, m * (1 - k) + k);
|
|
7330
|
-
b = 1 - Math.min(1, y * (1 - k) + k);
|
|
7110
|
+
convert$1.cmyk.rgb = function(cmyk) {
|
|
7111
|
+
const c = cmyk[0] / 100;
|
|
7112
|
+
const m = cmyk[1] / 100;
|
|
7113
|
+
const y = cmyk[2] / 100;
|
|
7114
|
+
const k = cmyk[3] / 100;
|
|
7115
|
+
const r = 1 - Math.min(1, c * (1 - k) + k);
|
|
7116
|
+
const g = 1 - Math.min(1, m * (1 - k) + k);
|
|
7117
|
+
const b = 1 - Math.min(1, y * (1 - k) + k);
|
|
7331
7118
|
return [r * 255, g * 255, b * 255];
|
|
7332
7119
|
};
|
|
7333
|
-
convert.xyz.rgb = function(xyz) {
|
|
7334
|
-
|
|
7335
|
-
|
|
7336
|
-
|
|
7337
|
-
|
|
7338
|
-
|
|
7339
|
-
|
|
7340
|
-
r = x * 3.
|
|
7341
|
-
g = x * -0.
|
|
7342
|
-
b = x * 0.
|
|
7343
|
-
r =
|
|
7344
|
-
g =
|
|
7345
|
-
b =
|
|
7346
|
-
r = Math.min(Math.max(0, r), 1);
|
|
7347
|
-
g = Math.min(Math.max(0, g), 1);
|
|
7348
|
-
b = Math.min(Math.max(0, b), 1);
|
|
7120
|
+
convert$1.xyz.rgb = function(xyz) {
|
|
7121
|
+
const x = xyz[0] / 100;
|
|
7122
|
+
const y = xyz[1] / 100;
|
|
7123
|
+
const z = xyz[2] / 100;
|
|
7124
|
+
let r;
|
|
7125
|
+
let g;
|
|
7126
|
+
let b;
|
|
7127
|
+
r = x * 3.2404542 + y * -1.5371385 + z * -0.4985314;
|
|
7128
|
+
g = x * -0.969266 + y * 1.8760108 + z * 0.041556;
|
|
7129
|
+
b = x * 0.0556434 + y * -0.2040259 + z * 1.0572252;
|
|
7130
|
+
r = srgbNonlinearTransform(r);
|
|
7131
|
+
g = srgbNonlinearTransform(g);
|
|
7132
|
+
b = srgbNonlinearTransform(b);
|
|
7349
7133
|
return [r * 255, g * 255, b * 255];
|
|
7350
7134
|
};
|
|
7351
|
-
convert.xyz.lab = function(xyz) {
|
|
7352
|
-
|
|
7353
|
-
|
|
7354
|
-
|
|
7355
|
-
var l;
|
|
7356
|
-
var a;
|
|
7357
|
-
var b;
|
|
7135
|
+
convert$1.xyz.lab = function(xyz) {
|
|
7136
|
+
let x = xyz[0];
|
|
7137
|
+
let y = xyz[1];
|
|
7138
|
+
let z = xyz[2];
|
|
7358
7139
|
x /= 95.047;
|
|
7359
7140
|
y /= 100;
|
|
7360
7141
|
z /= 108.883;
|
|
7361
|
-
x = x >
|
|
7362
|
-
y = y >
|
|
7363
|
-
z = z >
|
|
7364
|
-
l = 116 * y - 16;
|
|
7365
|
-
a = 500 * (x - y);
|
|
7366
|
-
b = 200 * (y - z);
|
|
7142
|
+
x = x > LAB_FT ? x ** (1 / 3) : 7.787 * x + 16 / 116;
|
|
7143
|
+
y = y > LAB_FT ? y ** (1 / 3) : 7.787 * y + 16 / 116;
|
|
7144
|
+
z = z > LAB_FT ? z ** (1 / 3) : 7.787 * z + 16 / 116;
|
|
7145
|
+
const l = 116 * y - 16;
|
|
7146
|
+
const a = 500 * (x - y);
|
|
7147
|
+
const b = 200 * (y - z);
|
|
7367
7148
|
return [l, a, b];
|
|
7368
7149
|
};
|
|
7369
|
-
convert.
|
|
7370
|
-
|
|
7371
|
-
|
|
7372
|
-
|
|
7373
|
-
|
|
7374
|
-
|
|
7375
|
-
|
|
7150
|
+
convert$1.xyz.oklab = function(xyz) {
|
|
7151
|
+
const x = xyz[0] / 100;
|
|
7152
|
+
const y = xyz[1] / 100;
|
|
7153
|
+
const z = xyz[2] / 100;
|
|
7154
|
+
const lp = Math.cbrt(0.8189330101 * x + 0.3618667424 * y - 0.1288597137 * z);
|
|
7155
|
+
const mp = Math.cbrt(0.0329845436 * x + 0.9293118715 * y + 0.0361456387 * z);
|
|
7156
|
+
const sp = Math.cbrt(0.0482003018 * x + 0.2643662691 * y + 0.633851707 * z);
|
|
7157
|
+
const l = 0.2104542553 * lp + 0.793617785 * mp - 0.0040720468 * sp;
|
|
7158
|
+
const a = 1.9779984951 * lp - 2.428592205 * mp + 0.4505937099 * sp;
|
|
7159
|
+
const b = 0.0259040371 * lp + 0.7827717662 * mp - 0.808675766 * sp;
|
|
7160
|
+
return [l * 100, a * 100, b * 100];
|
|
7161
|
+
};
|
|
7162
|
+
convert$1.oklab.oklch = function(oklab) {
|
|
7163
|
+
return convert$1.lab.lch(oklab);
|
|
7164
|
+
};
|
|
7165
|
+
convert$1.oklab.xyz = function(oklab) {
|
|
7166
|
+
const ll = oklab[0] / 100;
|
|
7167
|
+
const a = oklab[1] / 100;
|
|
7168
|
+
const b = oklab[2] / 100;
|
|
7169
|
+
const l = (0.999999998 * ll + 0.396337792 * a + 0.215803758 * b) ** 3;
|
|
7170
|
+
const m = (1.000000008 * ll - 0.105561342 * a - 0.063854175 * b) ** 3;
|
|
7171
|
+
const s = (1.000000055 * ll - 0.089484182 * a - 1.291485538 * b) ** 3;
|
|
7172
|
+
const x = 1.227013851 * l - 0.55779998 * m + 0.281256149 * s;
|
|
7173
|
+
const y = -0.040580178 * l + 1.11225687 * m - 0.071676679 * s;
|
|
7174
|
+
const z = -0.076381285 * l - 0.421481978 * m + 1.58616322 * s;
|
|
7175
|
+
return [x * 100, y * 100, z * 100];
|
|
7176
|
+
};
|
|
7177
|
+
convert$1.oklab.rgb = function(oklab) {
|
|
7178
|
+
const ll = oklab[0] / 100;
|
|
7179
|
+
const aa = oklab[1] / 100;
|
|
7180
|
+
const bb = oklab[2] / 100;
|
|
7181
|
+
const l = (ll + 0.3963377774 * aa + 0.2158037573 * bb) ** 3;
|
|
7182
|
+
const m = (ll - 0.1055613458 * aa - 0.0638541728 * bb) ** 3;
|
|
7183
|
+
const s = (ll - 0.0894841775 * aa - 1.291485548 * bb) ** 3;
|
|
7184
|
+
const r = srgbNonlinearTransform(4.0767416621 * l - 3.3077115913 * m + 0.2309699292 * s);
|
|
7185
|
+
const g = srgbNonlinearTransform(-1.2684380046 * l + 2.6097574011 * m - 0.3413193965 * s);
|
|
7186
|
+
const b = srgbNonlinearTransform(-0.0041960863 * l - 0.7034186147 * m + 1.707614701 * s);
|
|
7187
|
+
return [r * 255, g * 255, b * 255];
|
|
7188
|
+
};
|
|
7189
|
+
convert$1.oklch.oklab = function(oklch) {
|
|
7190
|
+
return convert$1.lch.lab(oklch);
|
|
7191
|
+
};
|
|
7192
|
+
convert$1.lab.xyz = function(lab) {
|
|
7193
|
+
const l = lab[0];
|
|
7194
|
+
const a = lab[1];
|
|
7195
|
+
const b = lab[2];
|
|
7196
|
+
let x;
|
|
7197
|
+
let y;
|
|
7198
|
+
let z;
|
|
7376
7199
|
y = (l + 16) / 116;
|
|
7377
7200
|
x = a / 500 + y;
|
|
7378
7201
|
z = y - b / 200;
|
|
7379
|
-
|
|
7380
|
-
|
|
7381
|
-
|
|
7382
|
-
y = y2 >
|
|
7383
|
-
x = x2 >
|
|
7384
|
-
z = z2 >
|
|
7202
|
+
const y2 = y ** 3;
|
|
7203
|
+
const x2 = x ** 3;
|
|
7204
|
+
const z2 = z ** 3;
|
|
7205
|
+
y = y2 > LAB_FT ? y2 : (y - 16 / 116) / 7.787;
|
|
7206
|
+
x = x2 > LAB_FT ? x2 : (x - 16 / 116) / 7.787;
|
|
7207
|
+
z = z2 > LAB_FT ? z2 : (z - 16 / 116) / 7.787;
|
|
7385
7208
|
x *= 95.047;
|
|
7386
7209
|
y *= 100;
|
|
7387
7210
|
z *= 108.883;
|
|
7388
7211
|
return [x, y, z];
|
|
7389
7212
|
};
|
|
7390
|
-
convert.lab.lch = function(lab) {
|
|
7391
|
-
|
|
7392
|
-
|
|
7393
|
-
|
|
7394
|
-
|
|
7395
|
-
|
|
7396
|
-
var c;
|
|
7397
|
-
hr = Math.atan2(b, a);
|
|
7213
|
+
convert$1.lab.lch = function(lab) {
|
|
7214
|
+
const l = lab[0];
|
|
7215
|
+
const a = lab[1];
|
|
7216
|
+
const b = lab[2];
|
|
7217
|
+
let h;
|
|
7218
|
+
const hr = Math.atan2(b, a);
|
|
7398
7219
|
h = hr * 360 / 2 / Math.PI;
|
|
7399
7220
|
if (h < 0) {
|
|
7400
7221
|
h += 360;
|
|
7401
7222
|
}
|
|
7402
|
-
c = Math.sqrt(a * a + b * b);
|
|
7223
|
+
const c = Math.sqrt(a * a + b * b);
|
|
7403
7224
|
return [l, c, h];
|
|
7404
7225
|
};
|
|
7405
|
-
convert.lch.lab = function(lch) {
|
|
7406
|
-
|
|
7407
|
-
|
|
7408
|
-
|
|
7409
|
-
|
|
7410
|
-
|
|
7411
|
-
|
|
7412
|
-
hr = h / 360 * 2 * Math.PI;
|
|
7413
|
-
a = c * Math.cos(hr);
|
|
7414
|
-
b = c * Math.sin(hr);
|
|
7226
|
+
convert$1.lch.lab = function(lch) {
|
|
7227
|
+
const l = lch[0];
|
|
7228
|
+
const c = lch[1];
|
|
7229
|
+
const h = lch[2];
|
|
7230
|
+
const hr = h / 360 * 2 * Math.PI;
|
|
7231
|
+
const a = c * Math.cos(hr);
|
|
7232
|
+
const b = c * Math.sin(hr);
|
|
7415
7233
|
return [l, a, b];
|
|
7416
7234
|
};
|
|
7417
|
-
convert.rgb.ansi16 = function(args) {
|
|
7418
|
-
|
|
7419
|
-
|
|
7420
|
-
var b = args[2];
|
|
7421
|
-
var value = 1 in arguments ? arguments[1] : convert.rgb.hsv(args)[2];
|
|
7235
|
+
convert$1.rgb.ansi16 = function(args, saturation = null) {
|
|
7236
|
+
const [r, g, b] = args;
|
|
7237
|
+
let value = saturation === null ? convert$1.rgb.hsv(args)[2] : saturation;
|
|
7422
7238
|
value = Math.round(value / 50);
|
|
7423
7239
|
if (value === 0) {
|
|
7424
7240
|
return 30;
|
|
7425
7241
|
}
|
|
7426
|
-
|
|
7242
|
+
let ansi = 30 + (Math.round(b / 255) << 2 | Math.round(g / 255) << 1 | Math.round(r / 255));
|
|
7427
7243
|
if (value === 2) {
|
|
7428
7244
|
ansi += 60;
|
|
7429
7245
|
}
|
|
7430
7246
|
return ansi;
|
|
7431
7247
|
};
|
|
7432
|
-
convert.hsv.ansi16 = function(args) {
|
|
7433
|
-
return convert.rgb.ansi16(convert.hsv.rgb(args), args[2]);
|
|
7248
|
+
convert$1.hsv.ansi16 = function(args) {
|
|
7249
|
+
return convert$1.rgb.ansi16(convert$1.hsv.rgb(args), args[2]);
|
|
7434
7250
|
};
|
|
7435
|
-
convert.rgb.ansi256 = function(args) {
|
|
7436
|
-
|
|
7437
|
-
|
|
7438
|
-
|
|
7439
|
-
if (r === g && g === b) {
|
|
7251
|
+
convert$1.rgb.ansi256 = function(args) {
|
|
7252
|
+
const r = args[0];
|
|
7253
|
+
const g = args[1];
|
|
7254
|
+
const b = args[2];
|
|
7255
|
+
if (r >> 4 === g >> 4 && g >> 4 === b >> 4) {
|
|
7440
7256
|
if (r < 8) {
|
|
7441
7257
|
return 16;
|
|
7442
7258
|
}
|
|
@@ -7445,11 +7261,12 @@ var require_conversions = __commonJS({
|
|
|
7445
7261
|
}
|
|
7446
7262
|
return Math.round((r - 8) / 247 * 24) + 232;
|
|
7447
7263
|
}
|
|
7448
|
-
|
|
7264
|
+
const ansi = 16 + 36 * Math.round(r / 255 * 5) + 6 * Math.round(g / 255 * 5) + Math.round(b / 255 * 5);
|
|
7449
7265
|
return ansi;
|
|
7450
7266
|
};
|
|
7451
|
-
convert.ansi16.rgb = function(args) {
|
|
7452
|
-
|
|
7267
|
+
convert$1.ansi16.rgb = function(args) {
|
|
7268
|
+
args = args[0];
|
|
7269
|
+
let color = args % 10;
|
|
7453
7270
|
if (color === 0 || color === 7) {
|
|
7454
7271
|
if (args > 50) {
|
|
7455
7272
|
color += 3.5;
|
|
@@ -7457,60 +7274,54 @@ var require_conversions = __commonJS({
|
|
|
7457
7274
|
color = color / 10.5 * 255;
|
|
7458
7275
|
return [color, color, color];
|
|
7459
7276
|
}
|
|
7460
|
-
|
|
7461
|
-
|
|
7462
|
-
|
|
7463
|
-
|
|
7277
|
+
const mult = (Math.trunc(args > 50) + 1) * 0.5;
|
|
7278
|
+
const r = (color & 1) * mult * 255;
|
|
7279
|
+
const g = (color >> 1 & 1) * mult * 255;
|
|
7280
|
+
const b = (color >> 2 & 1) * mult * 255;
|
|
7464
7281
|
return [r, g, b];
|
|
7465
7282
|
};
|
|
7466
|
-
convert.ansi256.rgb = function(args) {
|
|
7283
|
+
convert$1.ansi256.rgb = function(args) {
|
|
7284
|
+
args = args[0];
|
|
7467
7285
|
if (args >= 232) {
|
|
7468
|
-
|
|
7286
|
+
const c = (args - 232) * 10 + 8;
|
|
7469
7287
|
return [c, c, c];
|
|
7470
7288
|
}
|
|
7471
7289
|
args -= 16;
|
|
7472
|
-
|
|
7473
|
-
|
|
7474
|
-
|
|
7475
|
-
|
|
7290
|
+
let rem;
|
|
7291
|
+
const r = Math.floor(args / 36) / 5 * 255;
|
|
7292
|
+
const g = Math.floor((rem = args % 36) / 6) / 5 * 255;
|
|
7293
|
+
const b = rem % 6 / 5 * 255;
|
|
7476
7294
|
return [r, g, b];
|
|
7477
7295
|
};
|
|
7478
|
-
convert.rgb.hex = function(args) {
|
|
7479
|
-
|
|
7480
|
-
|
|
7481
|
-
return "000000".
|
|
7296
|
+
convert$1.rgb.hex = function(args) {
|
|
7297
|
+
const integer = ((Math.round(args[0]) & 255) << 16) + ((Math.round(args[1]) & 255) << 8) + (Math.round(args[2]) & 255);
|
|
7298
|
+
const string = integer.toString(16).toUpperCase();
|
|
7299
|
+
return "000000".slice(string.length) + string;
|
|
7482
7300
|
};
|
|
7483
|
-
convert.hex.rgb = function(args) {
|
|
7484
|
-
|
|
7301
|
+
convert$1.hex.rgb = function(args) {
|
|
7302
|
+
const match = args.toString(16).match(/[a-f\d]{6}|[a-f\d]{3}/i);
|
|
7485
7303
|
if (!match) {
|
|
7486
7304
|
return [0, 0, 0];
|
|
7487
7305
|
}
|
|
7488
|
-
|
|
7306
|
+
let colorString = match[0];
|
|
7489
7307
|
if (match[0].length === 3) {
|
|
7490
|
-
colorString = colorString.
|
|
7491
|
-
|
|
7492
|
-
|
|
7493
|
-
|
|
7494
|
-
|
|
7495
|
-
|
|
7496
|
-
var g = integer >> 8 & 255;
|
|
7497
|
-
var b = integer & 255;
|
|
7308
|
+
colorString = [...colorString].map((char) => char + char).join("");
|
|
7309
|
+
}
|
|
7310
|
+
const integer = Number.parseInt(colorString, 16);
|
|
7311
|
+
const r = integer >> 16 & 255;
|
|
7312
|
+
const g = integer >> 8 & 255;
|
|
7313
|
+
const b = integer & 255;
|
|
7498
7314
|
return [r, g, b];
|
|
7499
7315
|
};
|
|
7500
|
-
convert.rgb.hcg = function(rgb) {
|
|
7501
|
-
|
|
7502
|
-
|
|
7503
|
-
|
|
7504
|
-
|
|
7505
|
-
|
|
7506
|
-
|
|
7507
|
-
|
|
7508
|
-
|
|
7509
|
-
if (chroma < 1) {
|
|
7510
|
-
grayscale = min / (1 - chroma);
|
|
7511
|
-
} else {
|
|
7512
|
-
grayscale = 0;
|
|
7513
|
-
}
|
|
7316
|
+
convert$1.rgb.hcg = function(rgb) {
|
|
7317
|
+
const r = rgb[0] / 255;
|
|
7318
|
+
const g = rgb[1] / 255;
|
|
7319
|
+
const b = rgb[2] / 255;
|
|
7320
|
+
const max = Math.max(Math.max(r, g), b);
|
|
7321
|
+
const min = Math.min(Math.min(r, g), b);
|
|
7322
|
+
const chroma = max - min;
|
|
7323
|
+
let hue;
|
|
7324
|
+
const grayscale = chroma < 1 ? min / (1 - chroma) : 0;
|
|
7514
7325
|
if (chroma <= 0) {
|
|
7515
7326
|
hue = 0;
|
|
7516
7327
|
} else if (max === r) {
|
|
@@ -7518,79 +7329,80 @@ var require_conversions = __commonJS({
|
|
|
7518
7329
|
} else if (max === g) {
|
|
7519
7330
|
hue = 2 + (b - r) / chroma;
|
|
7520
7331
|
} else {
|
|
7521
|
-
hue = 4 + (r - g) / chroma
|
|
7332
|
+
hue = 4 + (r - g) / chroma;
|
|
7522
7333
|
}
|
|
7523
7334
|
hue /= 6;
|
|
7524
7335
|
hue %= 1;
|
|
7525
7336
|
return [hue * 360, chroma * 100, grayscale * 100];
|
|
7526
7337
|
};
|
|
7527
|
-
convert.hsl.hcg = function(hsl) {
|
|
7528
|
-
|
|
7529
|
-
|
|
7530
|
-
|
|
7531
|
-
|
|
7532
|
-
if (l < 0.5) {
|
|
7533
|
-
c = 2 * s * l;
|
|
7534
|
-
} else {
|
|
7535
|
-
c = 2 * s * (1 - l);
|
|
7536
|
-
}
|
|
7338
|
+
convert$1.hsl.hcg = function(hsl) {
|
|
7339
|
+
const s = hsl[1] / 100;
|
|
7340
|
+
const l = hsl[2] / 100;
|
|
7341
|
+
const c = l < 0.5 ? 2 * s * l : 2 * s * (1 - l);
|
|
7342
|
+
let f = 0;
|
|
7537
7343
|
if (c < 1) {
|
|
7538
7344
|
f = (l - 0.5 * c) / (1 - c);
|
|
7539
7345
|
}
|
|
7540
7346
|
return [hsl[0], c * 100, f * 100];
|
|
7541
7347
|
};
|
|
7542
|
-
convert.hsv.hcg = function(hsv) {
|
|
7543
|
-
|
|
7544
|
-
|
|
7545
|
-
|
|
7546
|
-
|
|
7348
|
+
convert$1.hsv.hcg = function(hsv) {
|
|
7349
|
+
const s = hsv[1] / 100;
|
|
7350
|
+
const v = hsv[2] / 100;
|
|
7351
|
+
const c = s * v;
|
|
7352
|
+
let f = 0;
|
|
7547
7353
|
if (c < 1) {
|
|
7548
7354
|
f = (v - c) / (1 - c);
|
|
7549
7355
|
}
|
|
7550
7356
|
return [hsv[0], c * 100, f * 100];
|
|
7551
7357
|
};
|
|
7552
|
-
convert.hcg.rgb = function(hcg) {
|
|
7553
|
-
|
|
7554
|
-
|
|
7555
|
-
|
|
7358
|
+
convert$1.hcg.rgb = function(hcg) {
|
|
7359
|
+
const h = hcg[0] / 360;
|
|
7360
|
+
const c = hcg[1] / 100;
|
|
7361
|
+
const g = hcg[2] / 100;
|
|
7556
7362
|
if (c === 0) {
|
|
7557
7363
|
return [g * 255, g * 255, g * 255];
|
|
7558
7364
|
}
|
|
7559
|
-
|
|
7560
|
-
|
|
7561
|
-
|
|
7562
|
-
|
|
7563
|
-
|
|
7365
|
+
const pure = [0, 0, 0];
|
|
7366
|
+
const hi = h % 1 * 6;
|
|
7367
|
+
const v = hi % 1;
|
|
7368
|
+
const w = 1 - v;
|
|
7369
|
+
let mg = 0;
|
|
7564
7370
|
switch (Math.floor(hi)) {
|
|
7565
|
-
case 0:
|
|
7371
|
+
case 0: {
|
|
7566
7372
|
pure[0] = 1;
|
|
7567
7373
|
pure[1] = v;
|
|
7568
7374
|
pure[2] = 0;
|
|
7569
7375
|
break;
|
|
7570
|
-
|
|
7376
|
+
}
|
|
7377
|
+
case 1: {
|
|
7571
7378
|
pure[0] = w;
|
|
7572
7379
|
pure[1] = 1;
|
|
7573
7380
|
pure[2] = 0;
|
|
7574
7381
|
break;
|
|
7575
|
-
|
|
7382
|
+
}
|
|
7383
|
+
case 2: {
|
|
7576
7384
|
pure[0] = 0;
|
|
7577
7385
|
pure[1] = 1;
|
|
7578
7386
|
pure[2] = v;
|
|
7579
7387
|
break;
|
|
7580
|
-
|
|
7388
|
+
}
|
|
7389
|
+
case 3: {
|
|
7581
7390
|
pure[0] = 0;
|
|
7582
7391
|
pure[1] = w;
|
|
7583
7392
|
pure[2] = 1;
|
|
7584
7393
|
break;
|
|
7585
|
-
|
|
7394
|
+
}
|
|
7395
|
+
case 4: {
|
|
7586
7396
|
pure[0] = v;
|
|
7587
7397
|
pure[1] = 0;
|
|
7588
7398
|
pure[2] = 1;
|
|
7589
7399
|
break;
|
|
7590
|
-
|
|
7400
|
+
}
|
|
7401
|
+
default: {
|
|
7591
7402
|
pure[0] = 1;
|
|
7592
7403
|
pure[1] = 0;
|
|
7593
7404
|
pure[2] = w;
|
|
7405
|
+
}
|
|
7594
7406
|
}
|
|
7595
7407
|
mg = (1 - c) * g;
|
|
7596
7408
|
return [
|
|
@@ -7599,21 +7411,21 @@ var require_conversions = __commonJS({
|
|
|
7599
7411
|
(c * pure[2] + mg) * 255
|
|
7600
7412
|
];
|
|
7601
7413
|
};
|
|
7602
|
-
convert.hcg.hsv = function(hcg) {
|
|
7603
|
-
|
|
7604
|
-
|
|
7605
|
-
|
|
7606
|
-
|
|
7414
|
+
convert$1.hcg.hsv = function(hcg) {
|
|
7415
|
+
const c = hcg[1] / 100;
|
|
7416
|
+
const g = hcg[2] / 100;
|
|
7417
|
+
const v = c + g * (1 - c);
|
|
7418
|
+
let f = 0;
|
|
7607
7419
|
if (v > 0) {
|
|
7608
7420
|
f = c / v;
|
|
7609
7421
|
}
|
|
7610
7422
|
return [hcg[0], f * 100, v * 100];
|
|
7611
7423
|
};
|
|
7612
|
-
convert.hcg.hsl = function(hcg) {
|
|
7613
|
-
|
|
7614
|
-
|
|
7615
|
-
|
|
7616
|
-
|
|
7424
|
+
convert$1.hcg.hsl = function(hcg) {
|
|
7425
|
+
const c = hcg[1] / 100;
|
|
7426
|
+
const g = hcg[2] / 100;
|
|
7427
|
+
const l = g * (1 - c) + 0.5 * c;
|
|
7428
|
+
let s = 0;
|
|
7617
7429
|
if (l > 0 && l < 0.5) {
|
|
7618
7430
|
s = c / (2 * l);
|
|
7619
7431
|
} else if (l >= 0.5 && l < 1) {
|
|
@@ -7621,67 +7433,60 @@ var require_conversions = __commonJS({
|
|
|
7621
7433
|
}
|
|
7622
7434
|
return [hcg[0], s * 100, l * 100];
|
|
7623
7435
|
};
|
|
7624
|
-
convert.hcg.hwb = function(hcg) {
|
|
7625
|
-
|
|
7626
|
-
|
|
7627
|
-
|
|
7436
|
+
convert$1.hcg.hwb = function(hcg) {
|
|
7437
|
+
const c = hcg[1] / 100;
|
|
7438
|
+
const g = hcg[2] / 100;
|
|
7439
|
+
const v = c + g * (1 - c);
|
|
7628
7440
|
return [hcg[0], (v - c) * 100, (1 - v) * 100];
|
|
7629
7441
|
};
|
|
7630
|
-
convert.hwb.hcg = function(hwb) {
|
|
7631
|
-
|
|
7632
|
-
|
|
7633
|
-
|
|
7634
|
-
|
|
7635
|
-
|
|
7442
|
+
convert$1.hwb.hcg = function(hwb) {
|
|
7443
|
+
const w = hwb[1] / 100;
|
|
7444
|
+
const b = hwb[2] / 100;
|
|
7445
|
+
const v = 1 - b;
|
|
7446
|
+
const c = v - w;
|
|
7447
|
+
let g = 0;
|
|
7636
7448
|
if (c < 1) {
|
|
7637
7449
|
g = (v - c) / (1 - c);
|
|
7638
7450
|
}
|
|
7639
7451
|
return [hwb[0], c * 100, g * 100];
|
|
7640
7452
|
};
|
|
7641
|
-
convert.apple.rgb = function(apple) {
|
|
7453
|
+
convert$1.apple.rgb = function(apple) {
|
|
7642
7454
|
return [apple[0] / 65535 * 255, apple[1] / 65535 * 255, apple[2] / 65535 * 255];
|
|
7643
7455
|
};
|
|
7644
|
-
convert.rgb.apple = function(rgb) {
|
|
7456
|
+
convert$1.rgb.apple = function(rgb) {
|
|
7645
7457
|
return [rgb[0] / 255 * 65535, rgb[1] / 255 * 65535, rgb[2] / 255 * 65535];
|
|
7646
7458
|
};
|
|
7647
|
-
convert.gray.rgb = function(args) {
|
|
7459
|
+
convert$1.gray.rgb = function(args) {
|
|
7648
7460
|
return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255];
|
|
7649
7461
|
};
|
|
7650
|
-
convert.gray.hsl =
|
|
7462
|
+
convert$1.gray.hsl = function(args) {
|
|
7651
7463
|
return [0, 0, args[0]];
|
|
7652
7464
|
};
|
|
7653
|
-
convert.gray.
|
|
7465
|
+
convert$1.gray.hsv = convert$1.gray.hsl;
|
|
7466
|
+
convert$1.gray.hwb = function(gray) {
|
|
7654
7467
|
return [0, 100, gray[0]];
|
|
7655
7468
|
};
|
|
7656
|
-
convert.gray.cmyk = function(gray) {
|
|
7469
|
+
convert$1.gray.cmyk = function(gray) {
|
|
7657
7470
|
return [0, 0, 0, gray[0]];
|
|
7658
7471
|
};
|
|
7659
|
-
convert.gray.lab = function(gray) {
|
|
7472
|
+
convert$1.gray.lab = function(gray) {
|
|
7660
7473
|
return [gray[0], 0, 0];
|
|
7661
7474
|
};
|
|
7662
|
-
convert.gray.hex = function(gray) {
|
|
7663
|
-
|
|
7664
|
-
|
|
7665
|
-
|
|
7666
|
-
return "000000".
|
|
7475
|
+
convert$1.gray.hex = function(gray) {
|
|
7476
|
+
const value = Math.round(gray[0] / 100 * 255) & 255;
|
|
7477
|
+
const integer = (value << 16) + (value << 8) + value;
|
|
7478
|
+
const string = integer.toString(16).toUpperCase();
|
|
7479
|
+
return "000000".slice(string.length) + string;
|
|
7667
7480
|
};
|
|
7668
|
-
convert.rgb.gray = function(rgb) {
|
|
7669
|
-
|
|
7670
|
-
return [
|
|
7481
|
+
convert$1.rgb.gray = function(rgb) {
|
|
7482
|
+
const value = (rgb[0] + rgb[1] + rgb[2]) / 3;
|
|
7483
|
+
return [value / 255 * 100];
|
|
7671
7484
|
};
|
|
7672
|
-
}
|
|
7673
|
-
});
|
|
7674
|
-
|
|
7675
|
-
// ../../node_modules/color-convert/route.js
|
|
7676
|
-
var require_route = __commonJS({
|
|
7677
|
-
"../../node_modules/color-convert/route.js"(exports2, module2) {
|
|
7678
|
-
"use strict";
|
|
7679
|
-
var conversions = require_conversions();
|
|
7680
7485
|
function buildGraph() {
|
|
7681
|
-
|
|
7682
|
-
|
|
7683
|
-
for (
|
|
7684
|
-
graph[
|
|
7486
|
+
const graph = {};
|
|
7487
|
+
const models2 = Object.keys(convert$1);
|
|
7488
|
+
for (let { length } = models2, i = 0; i < length; i++) {
|
|
7489
|
+
graph[models2[i]] = {
|
|
7685
7490
|
// http://jsperf.com/1-vs-infinity
|
|
7686
7491
|
// micro-opt, but this is simple.
|
|
7687
7492
|
distance: -1,
|
|
@@ -7691,15 +7496,15 @@ var require_route = __commonJS({
|
|
|
7691
7496
|
return graph;
|
|
7692
7497
|
}
|
|
7693
7498
|
function deriveBFS(fromModel) {
|
|
7694
|
-
|
|
7695
|
-
|
|
7499
|
+
const graph = buildGraph();
|
|
7500
|
+
const queue = [fromModel];
|
|
7696
7501
|
graph[fromModel].distance = 0;
|
|
7697
|
-
while (queue.length) {
|
|
7698
|
-
|
|
7699
|
-
|
|
7700
|
-
for (
|
|
7701
|
-
|
|
7702
|
-
|
|
7502
|
+
while (queue.length > 0) {
|
|
7503
|
+
const current = queue.pop();
|
|
7504
|
+
const adjacents = Object.keys(convert$1[current]);
|
|
7505
|
+
for (let { length } = adjacents, i = 0; i < length; i++) {
|
|
7506
|
+
const adjacent = adjacents[i];
|
|
7507
|
+
const node = graph[adjacent];
|
|
7703
7508
|
if (node.distance === -1) {
|
|
7704
7509
|
node.distance = graph[current].distance + 1;
|
|
7705
7510
|
node.parent = current;
|
|
@@ -7715,49 +7520,41 @@ var require_route = __commonJS({
|
|
|
7715
7520
|
};
|
|
7716
7521
|
}
|
|
7717
7522
|
function wrapConversion(toModel, graph) {
|
|
7718
|
-
|
|
7719
|
-
|
|
7720
|
-
|
|
7523
|
+
const path = [graph[toModel].parent, toModel];
|
|
7524
|
+
let fn = convert$1[graph[toModel].parent][toModel];
|
|
7525
|
+
let cur = graph[toModel].parent;
|
|
7721
7526
|
while (graph[cur].parent) {
|
|
7722
7527
|
path.unshift(graph[cur].parent);
|
|
7723
|
-
fn = link(
|
|
7528
|
+
fn = link(convert$1[graph[cur].parent][cur], fn);
|
|
7724
7529
|
cur = graph[cur].parent;
|
|
7725
7530
|
}
|
|
7726
7531
|
fn.conversion = path;
|
|
7727
7532
|
return fn;
|
|
7728
7533
|
}
|
|
7729
|
-
|
|
7730
|
-
|
|
7731
|
-
|
|
7732
|
-
|
|
7733
|
-
for (
|
|
7734
|
-
|
|
7735
|
-
|
|
7534
|
+
function route(fromModel) {
|
|
7535
|
+
const graph = deriveBFS(fromModel);
|
|
7536
|
+
const conversion = {};
|
|
7537
|
+
const models2 = Object.keys(graph);
|
|
7538
|
+
for (let { length } = models2, i = 0; i < length; i++) {
|
|
7539
|
+
const toModel = models2[i];
|
|
7540
|
+
const node = graph[toModel];
|
|
7736
7541
|
if (node.parent === null) {
|
|
7737
7542
|
continue;
|
|
7738
7543
|
}
|
|
7739
7544
|
conversion[toModel] = wrapConversion(toModel, graph);
|
|
7740
7545
|
}
|
|
7741
7546
|
return conversion;
|
|
7742
|
-
}
|
|
7743
|
-
}
|
|
7744
|
-
});
|
|
7745
|
-
|
|
7746
|
-
// ../../node_modules/color-convert/index.js
|
|
7747
|
-
var require_color_convert = __commonJS({
|
|
7748
|
-
"../../node_modules/color-convert/index.js"(exports2, module2) {
|
|
7749
|
-
"use strict";
|
|
7750
|
-
var conversions = require_conversions();
|
|
7751
|
-
var route = require_route();
|
|
7547
|
+
}
|
|
7752
7548
|
var convert = {};
|
|
7753
|
-
var models = Object.keys(
|
|
7549
|
+
var models = Object.keys(convert$1);
|
|
7754
7550
|
function wrapRaw(fn) {
|
|
7755
|
-
|
|
7756
|
-
|
|
7757
|
-
|
|
7551
|
+
const wrappedFn = function(...args) {
|
|
7552
|
+
const arg0 = args[0];
|
|
7553
|
+
if (arg0 === void 0 || arg0 === null) {
|
|
7554
|
+
return arg0;
|
|
7758
7555
|
}
|
|
7759
|
-
if (
|
|
7760
|
-
args =
|
|
7556
|
+
if (arg0.length > 1) {
|
|
7557
|
+
args = arg0;
|
|
7761
7558
|
}
|
|
7762
7559
|
return fn(args);
|
|
7763
7560
|
};
|
|
@@ -7767,16 +7564,17 @@ var require_color_convert = __commonJS({
|
|
|
7767
7564
|
return wrappedFn;
|
|
7768
7565
|
}
|
|
7769
7566
|
function wrapRounded(fn) {
|
|
7770
|
-
|
|
7771
|
-
|
|
7772
|
-
|
|
7567
|
+
const wrappedFn = function(...args) {
|
|
7568
|
+
const arg0 = args[0];
|
|
7569
|
+
if (arg0 === void 0 || arg0 === null) {
|
|
7570
|
+
return arg0;
|
|
7773
7571
|
}
|
|
7774
|
-
if (
|
|
7775
|
-
args =
|
|
7572
|
+
if (arg0.length > 1) {
|
|
7573
|
+
args = arg0;
|
|
7776
7574
|
}
|
|
7777
|
-
|
|
7575
|
+
const result = fn(args);
|
|
7778
7576
|
if (typeof result === "object") {
|
|
7779
|
-
for (
|
|
7577
|
+
for (let { length } = result, i = 0; i < length; i++) {
|
|
7780
7578
|
result[i] = Math.round(result[i]);
|
|
7781
7579
|
}
|
|
7782
7580
|
}
|
|
@@ -7787,45 +7585,34 @@ var require_color_convert = __commonJS({
|
|
|
7787
7585
|
}
|
|
7788
7586
|
return wrappedFn;
|
|
7789
7587
|
}
|
|
7790
|
-
|
|
7588
|
+
for (const fromModel of models) {
|
|
7791
7589
|
convert[fromModel] = {};
|
|
7792
|
-
Object.defineProperty(convert[fromModel], "channels", { value:
|
|
7793
|
-
Object.defineProperty(convert[fromModel], "labels", { value:
|
|
7794
|
-
|
|
7795
|
-
|
|
7796
|
-
|
|
7797
|
-
|
|
7590
|
+
Object.defineProperty(convert[fromModel], "channels", { value: convert$1[fromModel].channels });
|
|
7591
|
+
Object.defineProperty(convert[fromModel], "labels", { value: convert$1[fromModel].labels });
|
|
7592
|
+
const routes = route(fromModel);
|
|
7593
|
+
const routeModels = Object.keys(routes);
|
|
7594
|
+
for (const toModel of routeModels) {
|
|
7595
|
+
const fn = routes[toModel];
|
|
7798
7596
|
convert[fromModel][toModel] = wrapRounded(fn);
|
|
7799
7597
|
convert[fromModel][toModel].raw = wrapRaw(fn);
|
|
7800
|
-
}
|
|
7801
|
-
}
|
|
7802
|
-
module2.exports = convert;
|
|
7803
|
-
}
|
|
7804
|
-
});
|
|
7805
|
-
|
|
7806
|
-
// ../../node_modules/color/index.js
|
|
7807
|
-
var require_color = __commonJS({
|
|
7808
|
-
"../../node_modules/color/index.js"(exports2, module2) {
|
|
7809
|
-
"use strict";
|
|
7810
|
-
var colorString = require_color_string();
|
|
7811
|
-
var convert = require_color_convert();
|
|
7812
|
-
var _slice = [].slice;
|
|
7598
|
+
}
|
|
7599
|
+
}
|
|
7813
7600
|
var skippedModels = [
|
|
7814
|
-
//
|
|
7601
|
+
// To be honest, I don't really feel like keyword belongs in color convert, but eh.
|
|
7815
7602
|
"keyword",
|
|
7816
|
-
//
|
|
7603
|
+
// Gray conflicts with some method names, and has its own method defined.
|
|
7817
7604
|
"gray",
|
|
7818
|
-
//
|
|
7605
|
+
// Shouldn't really be in color-convert either...
|
|
7819
7606
|
"hex"
|
|
7820
7607
|
];
|
|
7821
7608
|
var hashedModelKeys = {};
|
|
7822
|
-
Object.keys(convert)
|
|
7823
|
-
hashedModelKeys[
|
|
7824
|
-
}
|
|
7609
|
+
for (const model of Object.keys(convert)) {
|
|
7610
|
+
hashedModelKeys[[...convert[model].labels].sort().join("")] = model;
|
|
7611
|
+
}
|
|
7825
7612
|
var limiters = {};
|
|
7826
|
-
function Color(
|
|
7613
|
+
function Color(object, model) {
|
|
7827
7614
|
if (!(this instanceof Color)) {
|
|
7828
|
-
return new Color(
|
|
7615
|
+
return new Color(object, model);
|
|
7829
7616
|
}
|
|
7830
7617
|
if (model && model in skippedModels) {
|
|
7831
7618
|
model = null;
|
|
@@ -7833,63 +7620,62 @@ var require_color = __commonJS({
|
|
|
7833
7620
|
if (model && !(model in convert)) {
|
|
7834
7621
|
throw new Error("Unknown model: " + model);
|
|
7835
7622
|
}
|
|
7836
|
-
|
|
7837
|
-
|
|
7838
|
-
if (
|
|
7623
|
+
let i;
|
|
7624
|
+
let channels;
|
|
7625
|
+
if (object == null) {
|
|
7839
7626
|
this.model = "rgb";
|
|
7840
7627
|
this.color = [0, 0, 0];
|
|
7841
7628
|
this.valpha = 1;
|
|
7842
|
-
} else if (
|
|
7843
|
-
this.model =
|
|
7844
|
-
this.color =
|
|
7845
|
-
this.valpha =
|
|
7846
|
-
} else if (typeof
|
|
7847
|
-
|
|
7629
|
+
} else if (object instanceof Color) {
|
|
7630
|
+
this.model = object.model;
|
|
7631
|
+
this.color = [...object.color];
|
|
7632
|
+
this.valpha = object.valpha;
|
|
7633
|
+
} else if (typeof object === "string") {
|
|
7634
|
+
const result = cs.get(object);
|
|
7848
7635
|
if (result === null) {
|
|
7849
|
-
throw new Error("Unable to parse color from string: " +
|
|
7636
|
+
throw new Error("Unable to parse color from string: " + object);
|
|
7850
7637
|
}
|
|
7851
7638
|
this.model = result.model;
|
|
7852
7639
|
channels = convert[this.model].channels;
|
|
7853
7640
|
this.color = result.value.slice(0, channels);
|
|
7854
7641
|
this.valpha = typeof result.value[channels] === "number" ? result.value[channels] : 1;
|
|
7855
|
-
} else if (
|
|
7642
|
+
} else if (object.length > 0) {
|
|
7856
7643
|
this.model = model || "rgb";
|
|
7857
7644
|
channels = convert[this.model].channels;
|
|
7858
|
-
|
|
7859
|
-
this.color = zeroArray(
|
|
7860
|
-
this.valpha = typeof
|
|
7861
|
-
} else if (typeof
|
|
7862
|
-
obj &= 16777215;
|
|
7645
|
+
const newArray = Array.prototype.slice.call(object, 0, channels);
|
|
7646
|
+
this.color = zeroArray(newArray, channels);
|
|
7647
|
+
this.valpha = typeof object[channels] === "number" ? object[channels] : 1;
|
|
7648
|
+
} else if (typeof object === "number") {
|
|
7863
7649
|
this.model = "rgb";
|
|
7864
7650
|
this.color = [
|
|
7865
|
-
|
|
7866
|
-
|
|
7867
|
-
|
|
7651
|
+
object >> 16 & 255,
|
|
7652
|
+
object >> 8 & 255,
|
|
7653
|
+
object & 255
|
|
7868
7654
|
];
|
|
7869
7655
|
this.valpha = 1;
|
|
7870
7656
|
} else {
|
|
7871
7657
|
this.valpha = 1;
|
|
7872
|
-
|
|
7873
|
-
if ("alpha" in
|
|
7658
|
+
const keys = Object.keys(object);
|
|
7659
|
+
if ("alpha" in object) {
|
|
7874
7660
|
keys.splice(keys.indexOf("alpha"), 1);
|
|
7875
|
-
this.valpha = typeof
|
|
7661
|
+
this.valpha = typeof object.alpha === "number" ? object.alpha : 0;
|
|
7876
7662
|
}
|
|
7877
|
-
|
|
7663
|
+
const hashedKeys = keys.sort().join("");
|
|
7878
7664
|
if (!(hashedKeys in hashedModelKeys)) {
|
|
7879
|
-
throw new Error("Unable to parse color from object: " + JSON.stringify(
|
|
7665
|
+
throw new Error("Unable to parse color from object: " + JSON.stringify(object));
|
|
7880
7666
|
}
|
|
7881
7667
|
this.model = hashedModelKeys[hashedKeys];
|
|
7882
|
-
|
|
7883
|
-
|
|
7668
|
+
const { labels } = convert[this.model];
|
|
7669
|
+
const color = [];
|
|
7884
7670
|
for (i = 0; i < labels.length; i++) {
|
|
7885
|
-
color.push(
|
|
7671
|
+
color.push(object[labels[i]]);
|
|
7886
7672
|
}
|
|
7887
7673
|
this.color = zeroArray(color);
|
|
7888
7674
|
}
|
|
7889
7675
|
if (limiters[this.model]) {
|
|
7890
7676
|
channels = convert[this.model].channels;
|
|
7891
7677
|
for (i = 0; i < channels; i++) {
|
|
7892
|
-
|
|
7678
|
+
const limit = limiters[this.model][i];
|
|
7893
7679
|
if (limit) {
|
|
7894
7680
|
this.color[i] = limit(this.color[i]);
|
|
7895
7681
|
}
|
|
@@ -7901,31 +7687,31 @@ var require_color = __commonJS({
|
|
|
7901
7687
|
}
|
|
7902
7688
|
}
|
|
7903
7689
|
Color.prototype = {
|
|
7904
|
-
toString
|
|
7690
|
+
toString() {
|
|
7905
7691
|
return this.string();
|
|
7906
7692
|
},
|
|
7907
|
-
toJSON
|
|
7693
|
+
toJSON() {
|
|
7908
7694
|
return this[this.model]();
|
|
7909
7695
|
},
|
|
7910
|
-
string
|
|
7911
|
-
|
|
7696
|
+
string(places) {
|
|
7697
|
+
let self2 = this.model in cs.to ? this : this.rgb();
|
|
7912
7698
|
self2 = self2.round(typeof places === "number" ? places : 1);
|
|
7913
|
-
|
|
7914
|
-
return
|
|
7699
|
+
const arguments_ = self2.valpha === 1 ? self2.color : [...self2.color, this.valpha];
|
|
7700
|
+
return cs.to[self2.model](...arguments_);
|
|
7915
7701
|
},
|
|
7916
|
-
percentString
|
|
7917
|
-
|
|
7918
|
-
|
|
7919
|
-
return
|
|
7702
|
+
percentString(places) {
|
|
7703
|
+
const self2 = this.rgb().round(typeof places === "number" ? places : 1);
|
|
7704
|
+
const arguments_ = self2.valpha === 1 ? self2.color : [...self2.color, this.valpha];
|
|
7705
|
+
return cs.to.rgb.percent(...arguments_);
|
|
7920
7706
|
},
|
|
7921
|
-
array
|
|
7922
|
-
return this.valpha === 1 ? this.color
|
|
7707
|
+
array() {
|
|
7708
|
+
return this.valpha === 1 ? [...this.color] : [...this.color, this.valpha];
|
|
7923
7709
|
},
|
|
7924
|
-
object
|
|
7925
|
-
|
|
7926
|
-
|
|
7927
|
-
|
|
7928
|
-
for (
|
|
7710
|
+
object() {
|
|
7711
|
+
const result = {};
|
|
7712
|
+
const { channels } = convert[this.model];
|
|
7713
|
+
const { labels } = convert[this.model];
|
|
7714
|
+
for (let i = 0; i < channels; i++) {
|
|
7929
7715
|
result[labels[i]] = this.color[i];
|
|
7930
7716
|
}
|
|
7931
7717
|
if (this.valpha !== 1) {
|
|
@@ -7933,8 +7719,8 @@ var require_color = __commonJS({
|
|
|
7933
7719
|
}
|
|
7934
7720
|
return result;
|
|
7935
7721
|
},
|
|
7936
|
-
unitArray
|
|
7937
|
-
|
|
7722
|
+
unitArray() {
|
|
7723
|
+
const rgb = this.rgb().color;
|
|
7938
7724
|
rgb[0] /= 255;
|
|
7939
7725
|
rgb[1] /= 255;
|
|
7940
7726
|
rgb[2] /= 255;
|
|
@@ -7943,8 +7729,8 @@ var require_color = __commonJS({
|
|
|
7943
7729
|
}
|
|
7944
7730
|
return rgb;
|
|
7945
7731
|
},
|
|
7946
|
-
unitObject
|
|
7947
|
-
|
|
7732
|
+
unitObject() {
|
|
7733
|
+
const rgb = this.rgb().object();
|
|
7948
7734
|
rgb.r /= 255;
|
|
7949
7735
|
rgb.g /= 255;
|
|
7950
7736
|
rgb.b /= 255;
|
|
@@ -7953,24 +7739,21 @@ var require_color = __commonJS({
|
|
|
7953
7739
|
}
|
|
7954
7740
|
return rgb;
|
|
7955
7741
|
},
|
|
7956
|
-
round
|
|
7742
|
+
round(places) {
|
|
7957
7743
|
places = Math.max(places || 0, 0);
|
|
7958
|
-
return new Color(this.color.map(roundToPlace(places))
|
|
7744
|
+
return new Color([...this.color.map(roundToPlace(places)), this.valpha], this.model);
|
|
7959
7745
|
},
|
|
7960
|
-
alpha
|
|
7961
|
-
if (
|
|
7962
|
-
return new Color(this.color
|
|
7746
|
+
alpha(value) {
|
|
7747
|
+
if (value !== void 0) {
|
|
7748
|
+
return new Color([...this.color, Math.max(0, Math.min(1, value))], this.model);
|
|
7963
7749
|
}
|
|
7964
7750
|
return this.valpha;
|
|
7965
7751
|
},
|
|
7966
|
-
//
|
|
7752
|
+
// Rgb
|
|
7967
7753
|
red: getset("rgb", 0, maxfn(255)),
|
|
7968
7754
|
green: getset("rgb", 1, maxfn(255)),
|
|
7969
7755
|
blue: getset("rgb", 2, maxfn(255)),
|
|
7970
|
-
hue: getset(["hsl", "hsv", "hsl", "hwb", "hcg"], 0,
|
|
7971
|
-
return (val % 360 + 360) % 360;
|
|
7972
|
-
}),
|
|
7973
|
-
// eslint-disable-line brace-style
|
|
7756
|
+
hue: getset(["hsl", "hsv", "hsl", "hwb", "hcg"], 0, (value) => (value % 360 + 360) % 360),
|
|
7974
7757
|
saturationl: getset("hsl", 1, maxfn(100)),
|
|
7975
7758
|
lightness: getset("hsl", 2, maxfn(100)),
|
|
7976
7759
|
saturationv: getset("hsv", 1, maxfn(100)),
|
|
@@ -7983,127 +7766,138 @@ var require_color = __commonJS({
|
|
|
7983
7766
|
magenta: getset("cmyk", 1, maxfn(100)),
|
|
7984
7767
|
yellow: getset("cmyk", 2, maxfn(100)),
|
|
7985
7768
|
black: getset("cmyk", 3, maxfn(100)),
|
|
7986
|
-
x: getset("xyz", 0, maxfn(
|
|
7769
|
+
x: getset("xyz", 0, maxfn(95.047)),
|
|
7987
7770
|
y: getset("xyz", 1, maxfn(100)),
|
|
7988
|
-
z: getset("xyz", 2, maxfn(
|
|
7771
|
+
z: getset("xyz", 2, maxfn(108.833)),
|
|
7989
7772
|
l: getset("lab", 0, maxfn(100)),
|
|
7990
7773
|
a: getset("lab", 1),
|
|
7991
7774
|
b: getset("lab", 2),
|
|
7992
|
-
keyword
|
|
7993
|
-
if (
|
|
7994
|
-
return new Color(
|
|
7775
|
+
keyword(value) {
|
|
7776
|
+
if (value !== void 0) {
|
|
7777
|
+
return new Color(value);
|
|
7995
7778
|
}
|
|
7996
7779
|
return convert[this.model].keyword(this.color);
|
|
7997
7780
|
},
|
|
7998
|
-
hex
|
|
7999
|
-
if (
|
|
8000
|
-
return new Color(
|
|
7781
|
+
hex(value) {
|
|
7782
|
+
if (value !== void 0) {
|
|
7783
|
+
return new Color(value);
|
|
7784
|
+
}
|
|
7785
|
+
return cs.to.hex(...this.rgb().round().color);
|
|
7786
|
+
},
|
|
7787
|
+
hexa(value) {
|
|
7788
|
+
if (value !== void 0) {
|
|
7789
|
+
return new Color(value);
|
|
8001
7790
|
}
|
|
8002
|
-
|
|
7791
|
+
const rgbArray = this.rgb().round().color;
|
|
7792
|
+
let alphaHex = Math.round(this.valpha * 255).toString(16).toUpperCase();
|
|
7793
|
+
if (alphaHex.length === 1) {
|
|
7794
|
+
alphaHex = "0" + alphaHex;
|
|
7795
|
+
}
|
|
7796
|
+
return cs.to.hex(...rgbArray) + alphaHex;
|
|
8003
7797
|
},
|
|
8004
|
-
rgbNumber
|
|
8005
|
-
|
|
7798
|
+
rgbNumber() {
|
|
7799
|
+
const rgb = this.rgb().color;
|
|
8006
7800
|
return (rgb[0] & 255) << 16 | (rgb[1] & 255) << 8 | rgb[2] & 255;
|
|
8007
7801
|
},
|
|
8008
|
-
luminosity
|
|
8009
|
-
|
|
8010
|
-
|
|
8011
|
-
for (
|
|
8012
|
-
|
|
8013
|
-
lum[i] = chan <= 0.
|
|
7802
|
+
luminosity() {
|
|
7803
|
+
const rgb = this.rgb().color;
|
|
7804
|
+
const lum = [];
|
|
7805
|
+
for (const [i, element] of rgb.entries()) {
|
|
7806
|
+
const chan = element / 255;
|
|
7807
|
+
lum[i] = chan <= 0.04045 ? chan / 12.92 : ((chan + 0.055) / 1.055) ** 2.4;
|
|
8014
7808
|
}
|
|
8015
7809
|
return 0.2126 * lum[0] + 0.7152 * lum[1] + 0.0722 * lum[2];
|
|
8016
7810
|
},
|
|
8017
|
-
contrast
|
|
8018
|
-
|
|
8019
|
-
|
|
7811
|
+
contrast(color2) {
|
|
7812
|
+
const lum1 = this.luminosity();
|
|
7813
|
+
const lum2 = color2.luminosity();
|
|
8020
7814
|
if (lum1 > lum2) {
|
|
8021
7815
|
return (lum1 + 0.05) / (lum2 + 0.05);
|
|
8022
7816
|
}
|
|
8023
7817
|
return (lum2 + 0.05) / (lum1 + 0.05);
|
|
8024
7818
|
},
|
|
8025
|
-
level
|
|
8026
|
-
|
|
8027
|
-
if (contrastRatio >= 7
|
|
7819
|
+
level(color2) {
|
|
7820
|
+
const contrastRatio = this.contrast(color2);
|
|
7821
|
+
if (contrastRatio >= 7) {
|
|
8028
7822
|
return "AAA";
|
|
8029
7823
|
}
|
|
8030
7824
|
return contrastRatio >= 4.5 ? "AA" : "";
|
|
8031
7825
|
},
|
|
8032
|
-
isDark
|
|
8033
|
-
|
|
8034
|
-
|
|
7826
|
+
isDark() {
|
|
7827
|
+
const rgb = this.rgb().color;
|
|
7828
|
+
const yiq = (rgb[0] * 2126 + rgb[1] * 7152 + rgb[2] * 722) / 1e4;
|
|
8035
7829
|
return yiq < 128;
|
|
8036
7830
|
},
|
|
8037
|
-
isLight
|
|
7831
|
+
isLight() {
|
|
8038
7832
|
return !this.isDark();
|
|
8039
7833
|
},
|
|
8040
|
-
negate
|
|
8041
|
-
|
|
8042
|
-
for (
|
|
7834
|
+
negate() {
|
|
7835
|
+
const rgb = this.rgb();
|
|
7836
|
+
for (let i = 0; i < 3; i++) {
|
|
8043
7837
|
rgb.color[i] = 255 - rgb.color[i];
|
|
8044
7838
|
}
|
|
8045
7839
|
return rgb;
|
|
8046
7840
|
},
|
|
8047
|
-
lighten
|
|
8048
|
-
|
|
7841
|
+
lighten(ratio) {
|
|
7842
|
+
const hsl = this.hsl();
|
|
8049
7843
|
hsl.color[2] += hsl.color[2] * ratio;
|
|
8050
7844
|
return hsl;
|
|
8051
7845
|
},
|
|
8052
|
-
darken
|
|
8053
|
-
|
|
7846
|
+
darken(ratio) {
|
|
7847
|
+
const hsl = this.hsl();
|
|
8054
7848
|
hsl.color[2] -= hsl.color[2] * ratio;
|
|
8055
7849
|
return hsl;
|
|
8056
7850
|
},
|
|
8057
|
-
saturate
|
|
8058
|
-
|
|
7851
|
+
saturate(ratio) {
|
|
7852
|
+
const hsl = this.hsl();
|
|
8059
7853
|
hsl.color[1] += hsl.color[1] * ratio;
|
|
8060
7854
|
return hsl;
|
|
8061
7855
|
},
|
|
8062
|
-
desaturate
|
|
8063
|
-
|
|
7856
|
+
desaturate(ratio) {
|
|
7857
|
+
const hsl = this.hsl();
|
|
8064
7858
|
hsl.color[1] -= hsl.color[1] * ratio;
|
|
8065
7859
|
return hsl;
|
|
8066
7860
|
},
|
|
8067
|
-
whiten
|
|
8068
|
-
|
|
7861
|
+
whiten(ratio) {
|
|
7862
|
+
const hwb = this.hwb();
|
|
8069
7863
|
hwb.color[1] += hwb.color[1] * ratio;
|
|
8070
7864
|
return hwb;
|
|
8071
7865
|
},
|
|
8072
|
-
blacken
|
|
8073
|
-
|
|
7866
|
+
blacken(ratio) {
|
|
7867
|
+
const hwb = this.hwb();
|
|
8074
7868
|
hwb.color[2] += hwb.color[2] * ratio;
|
|
8075
7869
|
return hwb;
|
|
8076
7870
|
},
|
|
8077
|
-
grayscale
|
|
8078
|
-
|
|
8079
|
-
|
|
8080
|
-
return Color.rgb(
|
|
7871
|
+
grayscale() {
|
|
7872
|
+
const rgb = this.rgb().color;
|
|
7873
|
+
const value = rgb[0] * 0.3 + rgb[1] * 0.59 + rgb[2] * 0.11;
|
|
7874
|
+
return Color.rgb(value, value, value);
|
|
8081
7875
|
},
|
|
8082
|
-
fade
|
|
7876
|
+
fade(ratio) {
|
|
8083
7877
|
return this.alpha(this.valpha - this.valpha * ratio);
|
|
8084
7878
|
},
|
|
8085
|
-
opaquer
|
|
7879
|
+
opaquer(ratio) {
|
|
8086
7880
|
return this.alpha(this.valpha + this.valpha * ratio);
|
|
8087
7881
|
},
|
|
8088
|
-
rotate
|
|
8089
|
-
|
|
8090
|
-
|
|
7882
|
+
rotate(degrees) {
|
|
7883
|
+
const hsl = this.hsl();
|
|
7884
|
+
let hue = hsl.color[0];
|
|
8091
7885
|
hue = (hue + degrees) % 360;
|
|
8092
7886
|
hue = hue < 0 ? 360 + hue : hue;
|
|
8093
7887
|
hsl.color[0] = hue;
|
|
8094
7888
|
return hsl;
|
|
8095
7889
|
},
|
|
8096
|
-
mix
|
|
7890
|
+
mix(mixinColor, weight) {
|
|
8097
7891
|
if (!mixinColor || !mixinColor.rgb) {
|
|
8098
7892
|
throw new Error('Argument to "mix" was not a Color instance, but rather an instance of ' + typeof mixinColor);
|
|
8099
7893
|
}
|
|
8100
|
-
|
|
8101
|
-
|
|
8102
|
-
|
|
8103
|
-
|
|
8104
|
-
|
|
8105
|
-
|
|
8106
|
-
|
|
7894
|
+
const color1 = mixinColor.rgb();
|
|
7895
|
+
const color2 = this.rgb();
|
|
7896
|
+
const p = weight === void 0 ? 0.5 : weight;
|
|
7897
|
+
const w = 2 * p - 1;
|
|
7898
|
+
const a = color1.alpha() - color2.alpha();
|
|
7899
|
+
const w1 = ((w * a === -1 ? w : (w + a) / (1 + w * a)) + 1) / 2;
|
|
7900
|
+
const w2 = 1 - w1;
|
|
8107
7901
|
return Color.rgb(
|
|
8108
7902
|
w1 * color1.red() + w2 * color2.red(),
|
|
8109
7903
|
w1 * color1.green() + w2 * color2.green(),
|
|
@@ -8112,50 +7906,50 @@ var require_color = __commonJS({
|
|
|
8112
7906
|
);
|
|
8113
7907
|
}
|
|
8114
7908
|
};
|
|
8115
|
-
Object.keys(convert)
|
|
8116
|
-
if (skippedModels.
|
|
8117
|
-
|
|
7909
|
+
for (const model of Object.keys(convert)) {
|
|
7910
|
+
if (skippedModels.includes(model)) {
|
|
7911
|
+
continue;
|
|
8118
7912
|
}
|
|
8119
|
-
|
|
8120
|
-
Color.prototype[model] = function() {
|
|
7913
|
+
const { channels } = convert[model];
|
|
7914
|
+
Color.prototype[model] = function(...arguments_) {
|
|
8121
7915
|
if (this.model === model) {
|
|
8122
7916
|
return new Color(this);
|
|
8123
7917
|
}
|
|
8124
|
-
if (
|
|
8125
|
-
return new Color(
|
|
7918
|
+
if (arguments_.length > 0) {
|
|
7919
|
+
return new Color(arguments_, model);
|
|
8126
7920
|
}
|
|
8127
|
-
|
|
8128
|
-
return new Color(assertArray(convert[this.model][model].raw(this.color)).concat(newAlpha), model);
|
|
7921
|
+
return new Color([...assertArray(convert[this.model][model].raw(this.color)), this.valpha], model);
|
|
8129
7922
|
};
|
|
8130
|
-
Color[model] = function(
|
|
7923
|
+
Color[model] = function(...arguments_) {
|
|
7924
|
+
let color = arguments_[0];
|
|
8131
7925
|
if (typeof color === "number") {
|
|
8132
|
-
color = zeroArray(
|
|
7926
|
+
color = zeroArray(arguments_, channels);
|
|
8133
7927
|
}
|
|
8134
7928
|
return new Color(color, model);
|
|
8135
7929
|
};
|
|
8136
|
-
}
|
|
8137
|
-
function roundTo(
|
|
8138
|
-
return Number(
|
|
7930
|
+
}
|
|
7931
|
+
function roundTo(number, places) {
|
|
7932
|
+
return Number(number.toFixed(places));
|
|
8139
7933
|
}
|
|
8140
7934
|
function roundToPlace(places) {
|
|
8141
|
-
return function(
|
|
8142
|
-
return roundTo(
|
|
7935
|
+
return function(number) {
|
|
7936
|
+
return roundTo(number, places);
|
|
8143
7937
|
};
|
|
8144
7938
|
}
|
|
8145
7939
|
function getset(model, channel, modifier) {
|
|
8146
7940
|
model = Array.isArray(model) ? model : [model];
|
|
8147
|
-
|
|
8148
|
-
(limiters[m]
|
|
8149
|
-
}
|
|
7941
|
+
for (const m of model) {
|
|
7942
|
+
(limiters[m] ||= [])[channel] = modifier;
|
|
7943
|
+
}
|
|
8150
7944
|
model = model[0];
|
|
8151
|
-
return function(
|
|
8152
|
-
|
|
8153
|
-
if (
|
|
7945
|
+
return function(value) {
|
|
7946
|
+
let result;
|
|
7947
|
+
if (value !== void 0) {
|
|
8154
7948
|
if (modifier) {
|
|
8155
|
-
|
|
7949
|
+
value = modifier(value);
|
|
8156
7950
|
}
|
|
8157
7951
|
result = this[model]();
|
|
8158
|
-
result.color[channel] =
|
|
7952
|
+
result.color[channel] = value;
|
|
8159
7953
|
return result;
|
|
8160
7954
|
}
|
|
8161
7955
|
result = this[model]().color[channel];
|
|
@@ -8170,26 +7964,21 @@ var require_color = __commonJS({
|
|
|
8170
7964
|
return Math.max(0, Math.min(max, v));
|
|
8171
7965
|
};
|
|
8172
7966
|
}
|
|
8173
|
-
function assertArray(
|
|
8174
|
-
return Array.isArray(
|
|
7967
|
+
function assertArray(value) {
|
|
7968
|
+
return Array.isArray(value) ? value : [value];
|
|
8175
7969
|
}
|
|
8176
|
-
function zeroArray(
|
|
8177
|
-
for (
|
|
8178
|
-
if (typeof
|
|
8179
|
-
|
|
7970
|
+
function zeroArray(array, length) {
|
|
7971
|
+
for (let i = 0; i < length; i++) {
|
|
7972
|
+
if (typeof array[i] !== "number") {
|
|
7973
|
+
array[i] = 0;
|
|
8180
7974
|
}
|
|
8181
7975
|
}
|
|
8182
|
-
return
|
|
7976
|
+
return array;
|
|
8183
7977
|
}
|
|
8184
|
-
|
|
8185
|
-
|
|
8186
|
-
}
|
|
8187
|
-
|
|
8188
|
-
// ../../node_modules/text-hex/index.js
|
|
8189
|
-
var require_text_hex = __commonJS({
|
|
8190
|
-
"../../node_modules/text-hex/index.js"(exports2, module2) {
|
|
8191
|
-
"use strict";
|
|
8192
|
-
module2.exports = function hex(str) {
|
|
7978
|
+
function getDefaultExportFromCjs(x) {
|
|
7979
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
7980
|
+
}
|
|
7981
|
+
var textHex = function hex2(str) {
|
|
8193
7982
|
for (var i = 0, hash = 0; i < str.length; hash = str.charCodeAt(i++) + ((hash << 5) - hash)) ;
|
|
8194
7983
|
var color = Math.floor(
|
|
8195
7984
|
Math.abs(
|
|
@@ -8198,24 +7987,17 @@ var require_text_hex = __commonJS({
|
|
|
8198
7987
|
).toString(16);
|
|
8199
7988
|
return "#" + Array(6 - color.length + 1).join("0") + color;
|
|
8200
7989
|
};
|
|
8201
|
-
|
|
8202
|
-
|
|
8203
|
-
|
|
8204
|
-
|
|
8205
|
-
var require_colorspace = __commonJS({
|
|
8206
|
-
"../../node_modules/colorspace/index.js"(exports2, module2) {
|
|
8207
|
-
"use strict";
|
|
8208
|
-
var color = require_color();
|
|
8209
|
-
var hex = require_text_hex();
|
|
8210
|
-
module2.exports = function colorspace(namespace, delimiter) {
|
|
8211
|
-
var split = namespace.split(delimiter || ":");
|
|
8212
|
-
var base = hex(split[0]);
|
|
7990
|
+
var hex = /* @__PURE__ */ getDefaultExportFromCjs(textHex);
|
|
7991
|
+
function colorspace(namespace, delimiter) {
|
|
7992
|
+
const split = namespace.split(delimiter || ":");
|
|
7993
|
+
let base = hex(split[0]);
|
|
8213
7994
|
if (!split.length) return base;
|
|
8214
|
-
for (
|
|
8215
|
-
base =
|
|
7995
|
+
for (let i = 0, l = split.length - 1; i < l; i++) {
|
|
7996
|
+
base = Color(base).mix(Color(hex(split[i + 1]))).saturate(1).hex();
|
|
8216
7997
|
}
|
|
8217
7998
|
return base;
|
|
8218
|
-
}
|
|
7999
|
+
}
|
|
8000
|
+
module2.exports = colorspace;
|
|
8219
8001
|
}
|
|
8220
8002
|
});
|
|
8221
8003
|
|
|
@@ -8266,7 +8048,7 @@ var require_kuler = __commonJS({
|
|
|
8266
8048
|
var require_namespace_ansi = __commonJS({
|
|
8267
8049
|
"../../node_modules/@dabh/diagnostics/modifiers/namespace-ansi.js"(exports2, module2) {
|
|
8268
8050
|
"use strict";
|
|
8269
|
-
var colorspace =
|
|
8051
|
+
var colorspace = require_index_cjs();
|
|
8270
8052
|
var kuler = require_kuler();
|
|
8271
8053
|
module2.exports = function ansiModifier(args, options) {
|
|
8272
8054
|
var namespace = options.namespace;
|
|
@@ -8549,6 +8331,28 @@ var require_file = __commonJS({
|
|
|
8549
8331
|
}
|
|
8550
8332
|
}
|
|
8551
8333
|
}
|
|
8334
|
+
/**
|
|
8335
|
+
* Called by Node.js Writable stream before emitting 'finish'.
|
|
8336
|
+
* Ensures all buffered data is flushed to the underlying file stream
|
|
8337
|
+
* before the transport signals completion.
|
|
8338
|
+
* @param {Function} callback - Callback to signal completion.
|
|
8339
|
+
* @private
|
|
8340
|
+
*/
|
|
8341
|
+
_final(callback) {
|
|
8342
|
+
if (this._opening) {
|
|
8343
|
+
this.once("open", () => this._final(callback));
|
|
8344
|
+
return;
|
|
8345
|
+
}
|
|
8346
|
+
this._stream.end();
|
|
8347
|
+
if (!this._dest) {
|
|
8348
|
+
return callback();
|
|
8349
|
+
}
|
|
8350
|
+
if (this._dest.writableFinished) {
|
|
8351
|
+
return callback();
|
|
8352
|
+
}
|
|
8353
|
+
this._dest.once("finish", callback);
|
|
8354
|
+
this._dest.once("error", callback);
|
|
8355
|
+
}
|
|
8552
8356
|
/**
|
|
8553
8357
|
* Core logging method exposed to Winston. Metadata is optional.
|
|
8554
8358
|
* @param {Object} info - TODO: add param description.
|
|
@@ -10222,6 +10026,7 @@ var require_logger = __commonJS({
|
|
|
10222
10026
|
if (info instanceof Error) {
|
|
10223
10027
|
infoClone.stack = info.stack;
|
|
10224
10028
|
infoClone.message = info.message;
|
|
10029
|
+
infoClone.cause = info.cause;
|
|
10225
10030
|
}
|
|
10226
10031
|
logger2.write(infoClone);
|
|
10227
10032
|
}
|
|
@@ -10291,6 +10096,23 @@ var require_logger = __commonJS({
|
|
|
10291
10096
|
this.rejections.handle(rejectionHandlers);
|
|
10292
10097
|
}
|
|
10293
10098
|
}
|
|
10099
|
+
/* eslint-disable valid-jsdoc */
|
|
10100
|
+
/**
|
|
10101
|
+
* Helper method to get the highest logging level associated with a logger
|
|
10102
|
+
*
|
|
10103
|
+
* @returns { number | null } - The highest configured logging level, null
|
|
10104
|
+
* for invalid configuration
|
|
10105
|
+
*/
|
|
10106
|
+
getHighestLogLevel() {
|
|
10107
|
+
const configuredLevelValue = getLevelValue(this.levels, this.level);
|
|
10108
|
+
if (!this.transports || this.transports.length === 0) {
|
|
10109
|
+
return configuredLevelValue;
|
|
10110
|
+
}
|
|
10111
|
+
return this.transports.reduce((max, transport) => {
|
|
10112
|
+
const levelValue = getLevelValue(this.levels, transport.level);
|
|
10113
|
+
return levelValue !== null && levelValue > max ? levelValue : max;
|
|
10114
|
+
}, configuredLevelValue);
|
|
10115
|
+
}
|
|
10294
10116
|
isLevelEnabled(level) {
|
|
10295
10117
|
const givenLevelValue = getLevelValue(this.levels, level);
|
|
10296
10118
|
if (givenLevelValue === null) {
|