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