@salesforce/ui-theme-manager 11.62.1 → 11.64.0
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/authoring/core/ThemeManagerPanelRoot.d.cts +7 -0
- package/dist/authoring/core/ThemeManagerPanelRoot.d.ts +7 -0
- package/dist/authoring/core/ThemeManagerPanelRoot.d.ts.map +1 -1
- package/dist/authoring/core/components/BordersSection.d.ts.map +1 -1
- package/dist/authoring/core/components/ButtonSection.d.cts +7 -0
- package/dist/authoring/core/components/ButtonSection.d.ts +7 -0
- package/dist/authoring/core/components/ButtonSection.d.ts.map +1 -1
- package/dist/authoring/core/components/ScaleValueRow.d.cts +43 -0
- package/dist/authoring/core/components/ScaleValueRow.d.ts +43 -0
- package/dist/authoring/core/components/ScaleValueRow.d.ts.map +1 -0
- package/dist/authoring/core/components/SectionTabs.d.cts +23 -0
- package/dist/authoring/core/components/SectionTabs.d.ts +23 -0
- package/dist/authoring/core/components/SectionTabs.d.ts.map +1 -0
- package/dist/authoring/core/components/TypographySection.d.ts.map +1 -1
- package/dist/authoring/core/labels.d.cts +22 -5
- package/dist/authoring/core/labels.d.ts +22 -5
- package/dist/authoring/core/labels.d.ts.map +1 -1
- package/dist/authoring/react/index.js +1 -1
- package/dist/authoring/react/styles.css +1 -1
- package/dist/authoring/web-component/index.d.cts +8 -0
- package/dist/authoring/web-component/index.d.ts +8 -0
- package/dist/authoring/web-component/index.d.ts.map +1 -1
- package/dist/authoring/web-component/index.js +180 -19
- package/dist/protocol/brandCss.cjs +38 -1
- package/dist/protocol/brandCss.d.cts +19 -0
- package/dist/protocol/brandCss.d.ts +19 -0
- package/dist/protocol/brandCss.d.ts.map +1 -1
- package/dist/protocol/brandCss.js +39 -2
- package/dist/protocol/brandSearch.cjs +24 -10
- package/dist/protocol/brandSearch.d.cts +24 -0
- package/dist/protocol/brandSearch.d.ts +24 -0
- package/dist/protocol/brandSearch.d.ts.map +1 -1
- package/dist/protocol/brandSearch.js +24 -10
- package/dist/protocol/index.cjs +6 -0
- package/dist/protocol/index.js +8 -2
- package/dist/runtime/previewContent.cjs +496 -217
- package/dist/runtime/previewContent.d.cts +31 -12
- package/dist/runtime/previewContent.d.ts +31 -12
- package/dist/runtime/previewContent.d.ts.map +1 -1
- package/dist/runtime/previewContent.js +498 -219
- package/dist/runtime/theme-preview-runtime.js +2526 -0
- package/package.json +1 -1
- package/dist/authoring/core/components/AssetsSection.d.cts +0 -12
- package/dist/authoring/core/components/AssetsSection.d.ts +0 -12
- package/dist/authoring/core/components/AssetsSection.d.ts.map +0 -1
|
@@ -49,6 +49,2499 @@
|
|
|
49
49
|
return rules.length > 0 ? "\n" + rules.join("\n") + "\n" : "";
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
+
// ../../node_modules/chroma-js/src/utils/limit.js
|
|
53
|
+
var limit_default = (x, low = 0, high = 1) => {
|
|
54
|
+
return min(max(low, x), high);
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
// ../../node_modules/chroma-js/src/utils/clip_rgb.js
|
|
58
|
+
var clip_rgb_default = (rgb2) => {
|
|
59
|
+
rgb2._clipped = false;
|
|
60
|
+
rgb2._unclipped = rgb2.slice(0);
|
|
61
|
+
for (let i = 0; i <= 3; i++) {
|
|
62
|
+
if (i < 3) {
|
|
63
|
+
if (rgb2[i] < 0 || rgb2[i] > 255) rgb2._clipped = true;
|
|
64
|
+
rgb2[i] = limit_default(rgb2[i], 0, 255);
|
|
65
|
+
} else if (i === 3) {
|
|
66
|
+
rgb2[i] = limit_default(rgb2[i], 0, 1);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return rgb2;
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
// ../../node_modules/chroma-js/src/utils/type.js
|
|
73
|
+
var classToType = {};
|
|
74
|
+
for (let name of [
|
|
75
|
+
"Boolean",
|
|
76
|
+
"Number",
|
|
77
|
+
"String",
|
|
78
|
+
"Function",
|
|
79
|
+
"Array",
|
|
80
|
+
"Date",
|
|
81
|
+
"RegExp",
|
|
82
|
+
"Undefined",
|
|
83
|
+
"Null"
|
|
84
|
+
]) {
|
|
85
|
+
classToType[`[object ${name}]`] = name.toLowerCase();
|
|
86
|
+
}
|
|
87
|
+
function type_default(obj) {
|
|
88
|
+
return classToType[Object.prototype.toString.call(obj)] || "object";
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// ../../node_modules/chroma-js/src/utils/unpack.js
|
|
92
|
+
var unpack_default = (args, keyOrder = null) => {
|
|
93
|
+
if (args.length >= 3) return Array.prototype.slice.call(args);
|
|
94
|
+
if (type_default(args[0]) == "object" && keyOrder) {
|
|
95
|
+
return keyOrder.split("").filter((k) => args[0][k] !== void 0).map((k) => args[0][k]);
|
|
96
|
+
}
|
|
97
|
+
return args[0];
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
// ../../node_modules/chroma-js/src/utils/last.js
|
|
101
|
+
var last_default = (args) => {
|
|
102
|
+
if (args.length < 2) return null;
|
|
103
|
+
const l = args.length - 1;
|
|
104
|
+
if (type_default(args[l]) == "string") return args[l].toLowerCase();
|
|
105
|
+
return null;
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
// ../../node_modules/chroma-js/src/utils/index.js
|
|
109
|
+
var { PI, min, max } = Math;
|
|
110
|
+
var TWOPI = PI * 2;
|
|
111
|
+
var PITHIRD = PI / 3;
|
|
112
|
+
var DEG2RAD = PI / 180;
|
|
113
|
+
var RAD2DEG = 180 / PI;
|
|
114
|
+
|
|
115
|
+
// ../../node_modules/chroma-js/src/io/input.js
|
|
116
|
+
var input_default = {
|
|
117
|
+
format: {},
|
|
118
|
+
autodetect: []
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
// ../../node_modules/chroma-js/src/Color.js
|
|
122
|
+
var Color = class {
|
|
123
|
+
constructor(...args) {
|
|
124
|
+
const me = this;
|
|
125
|
+
if (type_default(args[0]) === "object" && args[0].constructor && args[0].constructor === this.constructor) {
|
|
126
|
+
return args[0];
|
|
127
|
+
}
|
|
128
|
+
let mode = last_default(args);
|
|
129
|
+
let autodetect = false;
|
|
130
|
+
if (!mode) {
|
|
131
|
+
autodetect = true;
|
|
132
|
+
if (!input_default.sorted) {
|
|
133
|
+
input_default.autodetect = input_default.autodetect.sort((a, b) => b.p - a.p);
|
|
134
|
+
input_default.sorted = true;
|
|
135
|
+
}
|
|
136
|
+
for (let chk of input_default.autodetect) {
|
|
137
|
+
mode = chk.test(...args);
|
|
138
|
+
if (mode) break;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
if (input_default.format[mode]) {
|
|
142
|
+
const rgb2 = input_default.format[mode].apply(
|
|
143
|
+
null,
|
|
144
|
+
autodetect ? args : args.slice(0, -1)
|
|
145
|
+
);
|
|
146
|
+
me._rgb = clip_rgb_default(rgb2);
|
|
147
|
+
} else {
|
|
148
|
+
throw new Error("unknown format: " + args);
|
|
149
|
+
}
|
|
150
|
+
if (me._rgb.length === 3) me._rgb.push(1);
|
|
151
|
+
}
|
|
152
|
+
toString() {
|
|
153
|
+
if (type_default(this.hex) == "function") return this.hex();
|
|
154
|
+
return `[${this._rgb.join(",")}]`;
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
var Color_default = Color;
|
|
158
|
+
|
|
159
|
+
// ../../node_modules/chroma-js/src/version.js
|
|
160
|
+
var version = "2.6.0";
|
|
161
|
+
|
|
162
|
+
// ../../node_modules/chroma-js/src/chroma.js
|
|
163
|
+
var chroma = (...args) => {
|
|
164
|
+
return new chroma.Color(...args);
|
|
165
|
+
};
|
|
166
|
+
chroma.Color = Color_default;
|
|
167
|
+
chroma.version = version;
|
|
168
|
+
var chroma_default = chroma;
|
|
169
|
+
|
|
170
|
+
// ../../node_modules/chroma-js/src/io/cmyk/cmyk2rgb.js
|
|
171
|
+
var cmyk2rgb = (...args) => {
|
|
172
|
+
args = unpack_default(args, "cmyk");
|
|
173
|
+
const [c, m, y, k] = args;
|
|
174
|
+
const alpha = args.length > 4 ? args[4] : 1;
|
|
175
|
+
if (k === 1) return [0, 0, 0, alpha];
|
|
176
|
+
return [
|
|
177
|
+
c >= 1 ? 0 : 255 * (1 - c) * (1 - k),
|
|
178
|
+
// r
|
|
179
|
+
m >= 1 ? 0 : 255 * (1 - m) * (1 - k),
|
|
180
|
+
// g
|
|
181
|
+
y >= 1 ? 0 : 255 * (1 - y) * (1 - k),
|
|
182
|
+
// b
|
|
183
|
+
alpha
|
|
184
|
+
];
|
|
185
|
+
};
|
|
186
|
+
var cmyk2rgb_default = cmyk2rgb;
|
|
187
|
+
|
|
188
|
+
// ../../node_modules/chroma-js/src/io/cmyk/rgb2cmyk.js
|
|
189
|
+
var { max: max2 } = Math;
|
|
190
|
+
var rgb2cmyk = (...args) => {
|
|
191
|
+
let [r, g, b] = unpack_default(args, "rgb");
|
|
192
|
+
r = r / 255;
|
|
193
|
+
g = g / 255;
|
|
194
|
+
b = b / 255;
|
|
195
|
+
const k = 1 - max2(r, max2(g, b));
|
|
196
|
+
const f = k < 1 ? 1 / (1 - k) : 0;
|
|
197
|
+
const c = (1 - r - k) * f;
|
|
198
|
+
const m = (1 - g - k) * f;
|
|
199
|
+
const y = (1 - b - k) * f;
|
|
200
|
+
return [c, m, y, k];
|
|
201
|
+
};
|
|
202
|
+
var rgb2cmyk_default = rgb2cmyk;
|
|
203
|
+
|
|
204
|
+
// ../../node_modules/chroma-js/src/io/cmyk/index.js
|
|
205
|
+
Color_default.prototype.cmyk = function() {
|
|
206
|
+
return rgb2cmyk_default(this._rgb);
|
|
207
|
+
};
|
|
208
|
+
chroma_default.cmyk = (...args) => new Color_default(...args, "cmyk");
|
|
209
|
+
input_default.format.cmyk = cmyk2rgb_default;
|
|
210
|
+
input_default.autodetect.push({
|
|
211
|
+
p: 2,
|
|
212
|
+
test: (...args) => {
|
|
213
|
+
args = unpack_default(args, "cmyk");
|
|
214
|
+
if (type_default(args) === "array" && args.length === 4) {
|
|
215
|
+
return "cmyk";
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
});
|
|
219
|
+
|
|
220
|
+
// ../../node_modules/chroma-js/src/io/css/hsl2css.js
|
|
221
|
+
var rnd = (a) => Math.round(a * 100) / 100;
|
|
222
|
+
var hsl2css = (...args) => {
|
|
223
|
+
const hsla = unpack_default(args, "hsla");
|
|
224
|
+
let mode = last_default(args) || "lsa";
|
|
225
|
+
hsla[0] = rnd(hsla[0] || 0);
|
|
226
|
+
hsla[1] = rnd(hsla[1] * 100) + "%";
|
|
227
|
+
hsla[2] = rnd(hsla[2] * 100) + "%";
|
|
228
|
+
if (mode === "hsla" || hsla.length > 3 && hsla[3] < 1) {
|
|
229
|
+
hsla[3] = hsla.length > 3 ? hsla[3] : 1;
|
|
230
|
+
mode = "hsla";
|
|
231
|
+
} else {
|
|
232
|
+
hsla.length = 3;
|
|
233
|
+
}
|
|
234
|
+
return `${mode}(${hsla.join(",")})`;
|
|
235
|
+
};
|
|
236
|
+
var hsl2css_default = hsl2css;
|
|
237
|
+
|
|
238
|
+
// ../../node_modules/chroma-js/src/io/hsl/rgb2hsl.js
|
|
239
|
+
var rgb2hsl = (...args) => {
|
|
240
|
+
args = unpack_default(args, "rgba");
|
|
241
|
+
let [r, g, b] = args;
|
|
242
|
+
r /= 255;
|
|
243
|
+
g /= 255;
|
|
244
|
+
b /= 255;
|
|
245
|
+
const minRgb = min(r, g, b);
|
|
246
|
+
const maxRgb = max(r, g, b);
|
|
247
|
+
const l = (maxRgb + minRgb) / 2;
|
|
248
|
+
let s, h;
|
|
249
|
+
if (maxRgb === minRgb) {
|
|
250
|
+
s = 0;
|
|
251
|
+
h = Number.NaN;
|
|
252
|
+
} else {
|
|
253
|
+
s = l < 0.5 ? (maxRgb - minRgb) / (maxRgb + minRgb) : (maxRgb - minRgb) / (2 - maxRgb - minRgb);
|
|
254
|
+
}
|
|
255
|
+
if (r == maxRgb) h = (g - b) / (maxRgb - minRgb);
|
|
256
|
+
else if (g == maxRgb) h = 2 + (b - r) / (maxRgb - minRgb);
|
|
257
|
+
else if (b == maxRgb) h = 4 + (r - g) / (maxRgb - minRgb);
|
|
258
|
+
h *= 60;
|
|
259
|
+
if (h < 0) h += 360;
|
|
260
|
+
if (args.length > 3 && args[3] !== void 0) return [h, s, l, args[3]];
|
|
261
|
+
return [h, s, l];
|
|
262
|
+
};
|
|
263
|
+
var rgb2hsl_default = rgb2hsl;
|
|
264
|
+
|
|
265
|
+
// ../../node_modules/chroma-js/src/io/css/rgb2css.js
|
|
266
|
+
var { round } = Math;
|
|
267
|
+
var rgb2css = (...args) => {
|
|
268
|
+
const rgba = unpack_default(args, "rgba");
|
|
269
|
+
let mode = last_default(args) || "rgb";
|
|
270
|
+
if (mode.substr(0, 3) == "hsl") {
|
|
271
|
+
return hsl2css_default(rgb2hsl_default(rgba), mode);
|
|
272
|
+
}
|
|
273
|
+
rgba[0] = round(rgba[0]);
|
|
274
|
+
rgba[1] = round(rgba[1]);
|
|
275
|
+
rgba[2] = round(rgba[2]);
|
|
276
|
+
if (mode === "rgba" || rgba.length > 3 && rgba[3] < 1) {
|
|
277
|
+
rgba[3] = rgba.length > 3 ? rgba[3] : 1;
|
|
278
|
+
mode = "rgba";
|
|
279
|
+
}
|
|
280
|
+
return `${mode}(${rgba.slice(0, mode === "rgb" ? 3 : 4).join(",")})`;
|
|
281
|
+
};
|
|
282
|
+
var rgb2css_default = rgb2css;
|
|
283
|
+
|
|
284
|
+
// ../../node_modules/chroma-js/src/io/hsl/hsl2rgb.js
|
|
285
|
+
var { round: round2 } = Math;
|
|
286
|
+
var hsl2rgb = (...args) => {
|
|
287
|
+
args = unpack_default(args, "hsl");
|
|
288
|
+
const [h, s, l] = args;
|
|
289
|
+
let r, g, b;
|
|
290
|
+
if (s === 0) {
|
|
291
|
+
r = g = b = l * 255;
|
|
292
|
+
} else {
|
|
293
|
+
const t3 = [0, 0, 0];
|
|
294
|
+
const c = [0, 0, 0];
|
|
295
|
+
const t2 = l < 0.5 ? l * (1 + s) : l + s - l * s;
|
|
296
|
+
const t1 = 2 * l - t2;
|
|
297
|
+
const h_ = h / 360;
|
|
298
|
+
t3[0] = h_ + 1 / 3;
|
|
299
|
+
t3[1] = h_;
|
|
300
|
+
t3[2] = h_ - 1 / 3;
|
|
301
|
+
for (let i = 0; i < 3; i++) {
|
|
302
|
+
if (t3[i] < 0) t3[i] += 1;
|
|
303
|
+
if (t3[i] > 1) t3[i] -= 1;
|
|
304
|
+
if (6 * t3[i] < 1) c[i] = t1 + (t2 - t1) * 6 * t3[i];
|
|
305
|
+
else if (2 * t3[i] < 1) c[i] = t2;
|
|
306
|
+
else if (3 * t3[i] < 2) c[i] = t1 + (t2 - t1) * (2 / 3 - t3[i]) * 6;
|
|
307
|
+
else c[i] = t1;
|
|
308
|
+
}
|
|
309
|
+
[r, g, b] = [round2(c[0] * 255), round2(c[1] * 255), round2(c[2] * 255)];
|
|
310
|
+
}
|
|
311
|
+
if (args.length > 3) {
|
|
312
|
+
return [r, g, b, args[3]];
|
|
313
|
+
}
|
|
314
|
+
return [r, g, b, 1];
|
|
315
|
+
};
|
|
316
|
+
var hsl2rgb_default = hsl2rgb;
|
|
317
|
+
|
|
318
|
+
// ../../node_modules/chroma-js/src/io/css/css2rgb.js
|
|
319
|
+
var RE_RGB = /^rgb\(\s*(-?\d+),\s*(-?\d+)\s*,\s*(-?\d+)\s*\)$/;
|
|
320
|
+
var RE_RGBA = /^rgba\(\s*(-?\d+),\s*(-?\d+)\s*,\s*(-?\d+)\s*,\s*([01]|[01]?\.\d+)\)$/;
|
|
321
|
+
var RE_RGB_PCT = /^rgb\(\s*(-?\d+(?:\.\d+)?)%,\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*\)$/;
|
|
322
|
+
var RE_RGBA_PCT = /^rgba\(\s*(-?\d+(?:\.\d+)?)%,\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)$/;
|
|
323
|
+
var RE_HSL = /^hsl\(\s*(-?\d+(?:\.\d+)?),\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*\)$/;
|
|
324
|
+
var RE_HSLA = /^hsla\(\s*(-?\d+(?:\.\d+)?),\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)$/;
|
|
325
|
+
var { round: round3 } = Math;
|
|
326
|
+
var css2rgb = (css) => {
|
|
327
|
+
css = css.toLowerCase().trim();
|
|
328
|
+
let m;
|
|
329
|
+
if (input_default.format.named) {
|
|
330
|
+
try {
|
|
331
|
+
return input_default.format.named(css);
|
|
332
|
+
} catch (e) {
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
if (m = css.match(RE_RGB)) {
|
|
336
|
+
const rgb2 = m.slice(1, 4);
|
|
337
|
+
for (let i = 0; i < 3; i++) {
|
|
338
|
+
rgb2[i] = +rgb2[i];
|
|
339
|
+
}
|
|
340
|
+
rgb2[3] = 1;
|
|
341
|
+
return rgb2;
|
|
342
|
+
}
|
|
343
|
+
if (m = css.match(RE_RGBA)) {
|
|
344
|
+
const rgb2 = m.slice(1, 5);
|
|
345
|
+
for (let i = 0; i < 4; i++) {
|
|
346
|
+
rgb2[i] = +rgb2[i];
|
|
347
|
+
}
|
|
348
|
+
return rgb2;
|
|
349
|
+
}
|
|
350
|
+
if (m = css.match(RE_RGB_PCT)) {
|
|
351
|
+
const rgb2 = m.slice(1, 4);
|
|
352
|
+
for (let i = 0; i < 3; i++) {
|
|
353
|
+
rgb2[i] = round3(rgb2[i] * 2.55);
|
|
354
|
+
}
|
|
355
|
+
rgb2[3] = 1;
|
|
356
|
+
return rgb2;
|
|
357
|
+
}
|
|
358
|
+
if (m = css.match(RE_RGBA_PCT)) {
|
|
359
|
+
const rgb2 = m.slice(1, 5);
|
|
360
|
+
for (let i = 0; i < 3; i++) {
|
|
361
|
+
rgb2[i] = round3(rgb2[i] * 2.55);
|
|
362
|
+
}
|
|
363
|
+
rgb2[3] = +rgb2[3];
|
|
364
|
+
return rgb2;
|
|
365
|
+
}
|
|
366
|
+
if (m = css.match(RE_HSL)) {
|
|
367
|
+
const hsl2 = m.slice(1, 4);
|
|
368
|
+
hsl2[1] *= 0.01;
|
|
369
|
+
hsl2[2] *= 0.01;
|
|
370
|
+
const rgb2 = hsl2rgb_default(hsl2);
|
|
371
|
+
rgb2[3] = 1;
|
|
372
|
+
return rgb2;
|
|
373
|
+
}
|
|
374
|
+
if (m = css.match(RE_HSLA)) {
|
|
375
|
+
const hsl2 = m.slice(1, 4);
|
|
376
|
+
hsl2[1] *= 0.01;
|
|
377
|
+
hsl2[2] *= 0.01;
|
|
378
|
+
const rgb2 = hsl2rgb_default(hsl2);
|
|
379
|
+
rgb2[3] = +m[4];
|
|
380
|
+
return rgb2;
|
|
381
|
+
}
|
|
382
|
+
};
|
|
383
|
+
css2rgb.test = (s) => {
|
|
384
|
+
return RE_RGB.test(s) || RE_RGBA.test(s) || RE_RGB_PCT.test(s) || RE_RGBA_PCT.test(s) || RE_HSL.test(s) || RE_HSLA.test(s);
|
|
385
|
+
};
|
|
386
|
+
var css2rgb_default = css2rgb;
|
|
387
|
+
|
|
388
|
+
// ../../node_modules/chroma-js/src/io/css/index.js
|
|
389
|
+
Color_default.prototype.css = function(mode) {
|
|
390
|
+
return rgb2css_default(this._rgb, mode);
|
|
391
|
+
};
|
|
392
|
+
chroma_default.css = (...args) => new Color_default(...args, "css");
|
|
393
|
+
input_default.format.css = css2rgb_default;
|
|
394
|
+
input_default.autodetect.push({
|
|
395
|
+
p: 5,
|
|
396
|
+
test: (h, ...rest) => {
|
|
397
|
+
if (!rest.length && type_default(h) === "string" && css2rgb_default.test(h)) {
|
|
398
|
+
return "css";
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
});
|
|
402
|
+
|
|
403
|
+
// ../../node_modules/chroma-js/src/io/gl/index.js
|
|
404
|
+
input_default.format.gl = (...args) => {
|
|
405
|
+
const rgb2 = unpack_default(args, "rgba");
|
|
406
|
+
rgb2[0] *= 255;
|
|
407
|
+
rgb2[1] *= 255;
|
|
408
|
+
rgb2[2] *= 255;
|
|
409
|
+
return rgb2;
|
|
410
|
+
};
|
|
411
|
+
chroma_default.gl = (...args) => new Color_default(...args, "gl");
|
|
412
|
+
Color_default.prototype.gl = function() {
|
|
413
|
+
const rgb2 = this._rgb;
|
|
414
|
+
return [rgb2[0] / 255, rgb2[1] / 255, rgb2[2] / 255, rgb2[3]];
|
|
415
|
+
};
|
|
416
|
+
|
|
417
|
+
// ../../node_modules/chroma-js/src/io/hcg/hcg2rgb.js
|
|
418
|
+
var { floor } = Math;
|
|
419
|
+
var hcg2rgb = (...args) => {
|
|
420
|
+
args = unpack_default(args, "hcg");
|
|
421
|
+
let [h, c, _g] = args;
|
|
422
|
+
let r, g, b;
|
|
423
|
+
_g = _g * 255;
|
|
424
|
+
const _c = c * 255;
|
|
425
|
+
if (c === 0) {
|
|
426
|
+
r = g = b = _g;
|
|
427
|
+
} else {
|
|
428
|
+
if (h === 360) h = 0;
|
|
429
|
+
if (h > 360) h -= 360;
|
|
430
|
+
if (h < 0) h += 360;
|
|
431
|
+
h /= 60;
|
|
432
|
+
const i = floor(h);
|
|
433
|
+
const f = h - i;
|
|
434
|
+
const p = _g * (1 - c);
|
|
435
|
+
const q = p + _c * (1 - f);
|
|
436
|
+
const t = p + _c * f;
|
|
437
|
+
const v = p + _c;
|
|
438
|
+
switch (i) {
|
|
439
|
+
case 0:
|
|
440
|
+
[r, g, b] = [v, t, p];
|
|
441
|
+
break;
|
|
442
|
+
case 1:
|
|
443
|
+
[r, g, b] = [q, v, p];
|
|
444
|
+
break;
|
|
445
|
+
case 2:
|
|
446
|
+
[r, g, b] = [p, v, t];
|
|
447
|
+
break;
|
|
448
|
+
case 3:
|
|
449
|
+
[r, g, b] = [p, q, v];
|
|
450
|
+
break;
|
|
451
|
+
case 4:
|
|
452
|
+
[r, g, b] = [t, p, v];
|
|
453
|
+
break;
|
|
454
|
+
case 5:
|
|
455
|
+
[r, g, b] = [v, p, q];
|
|
456
|
+
break;
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
return [r, g, b, args.length > 3 ? args[3] : 1];
|
|
460
|
+
};
|
|
461
|
+
var hcg2rgb_default = hcg2rgb;
|
|
462
|
+
|
|
463
|
+
// ../../node_modules/chroma-js/src/io/hcg/rgb2hcg.js
|
|
464
|
+
var rgb2hcg = (...args) => {
|
|
465
|
+
const [r, g, b] = unpack_default(args, "rgb");
|
|
466
|
+
const minRgb = min(r, g, b);
|
|
467
|
+
const maxRgb = max(r, g, b);
|
|
468
|
+
const delta = maxRgb - minRgb;
|
|
469
|
+
const c = delta * 100 / 255;
|
|
470
|
+
const _g = minRgb / (255 - delta) * 100;
|
|
471
|
+
let h;
|
|
472
|
+
if (delta === 0) {
|
|
473
|
+
h = Number.NaN;
|
|
474
|
+
} else {
|
|
475
|
+
if (r === maxRgb) h = (g - b) / delta;
|
|
476
|
+
if (g === maxRgb) h = 2 + (b - r) / delta;
|
|
477
|
+
if (b === maxRgb) h = 4 + (r - g) / delta;
|
|
478
|
+
h *= 60;
|
|
479
|
+
if (h < 0) h += 360;
|
|
480
|
+
}
|
|
481
|
+
return [h, c, _g];
|
|
482
|
+
};
|
|
483
|
+
var rgb2hcg_default = rgb2hcg;
|
|
484
|
+
|
|
485
|
+
// ../../node_modules/chroma-js/src/io/hcg/index.js
|
|
486
|
+
Color_default.prototype.hcg = function() {
|
|
487
|
+
return rgb2hcg_default(this._rgb);
|
|
488
|
+
};
|
|
489
|
+
chroma_default.hcg = (...args) => new Color_default(...args, "hcg");
|
|
490
|
+
input_default.format.hcg = hcg2rgb_default;
|
|
491
|
+
input_default.autodetect.push({
|
|
492
|
+
p: 1,
|
|
493
|
+
test: (...args) => {
|
|
494
|
+
args = unpack_default(args, "hcg");
|
|
495
|
+
if (type_default(args) === "array" && args.length === 3) {
|
|
496
|
+
return "hcg";
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
});
|
|
500
|
+
|
|
501
|
+
// ../../node_modules/chroma-js/src/io/hex/hex2rgb.js
|
|
502
|
+
var RE_HEX = /^#?([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/;
|
|
503
|
+
var RE_HEXA = /^#?([A-Fa-f0-9]{8}|[A-Fa-f0-9]{4})$/;
|
|
504
|
+
var hex2rgb = (hex) => {
|
|
505
|
+
if (hex.match(RE_HEX)) {
|
|
506
|
+
if (hex.length === 4 || hex.length === 7) {
|
|
507
|
+
hex = hex.substr(1);
|
|
508
|
+
}
|
|
509
|
+
if (hex.length === 3) {
|
|
510
|
+
hex = hex.split("");
|
|
511
|
+
hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2];
|
|
512
|
+
}
|
|
513
|
+
const u = parseInt(hex, 16);
|
|
514
|
+
const r = u >> 16;
|
|
515
|
+
const g = u >> 8 & 255;
|
|
516
|
+
const b = u & 255;
|
|
517
|
+
return [r, g, b, 1];
|
|
518
|
+
}
|
|
519
|
+
if (hex.match(RE_HEXA)) {
|
|
520
|
+
if (hex.length === 5 || hex.length === 9) {
|
|
521
|
+
hex = hex.substr(1);
|
|
522
|
+
}
|
|
523
|
+
if (hex.length === 4) {
|
|
524
|
+
hex = hex.split("");
|
|
525
|
+
hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2] + hex[3] + hex[3];
|
|
526
|
+
}
|
|
527
|
+
const u = parseInt(hex, 16);
|
|
528
|
+
const r = u >> 24 & 255;
|
|
529
|
+
const g = u >> 16 & 255;
|
|
530
|
+
const b = u >> 8 & 255;
|
|
531
|
+
const a = Math.round((u & 255) / 255 * 100) / 100;
|
|
532
|
+
return [r, g, b, a];
|
|
533
|
+
}
|
|
534
|
+
throw new Error(`unknown hex color: ${hex}`);
|
|
535
|
+
};
|
|
536
|
+
var hex2rgb_default = hex2rgb;
|
|
537
|
+
|
|
538
|
+
// ../../node_modules/chroma-js/src/io/hex/rgb2hex.js
|
|
539
|
+
var { round: round4 } = Math;
|
|
540
|
+
var rgb2hex = (...args) => {
|
|
541
|
+
let [r, g, b, a] = unpack_default(args, "rgba");
|
|
542
|
+
let mode = last_default(args) || "auto";
|
|
543
|
+
if (a === void 0) a = 1;
|
|
544
|
+
if (mode === "auto") {
|
|
545
|
+
mode = a < 1 ? "rgba" : "rgb";
|
|
546
|
+
}
|
|
547
|
+
r = round4(r);
|
|
548
|
+
g = round4(g);
|
|
549
|
+
b = round4(b);
|
|
550
|
+
const u = r << 16 | g << 8 | b;
|
|
551
|
+
let str = "000000" + u.toString(16);
|
|
552
|
+
str = str.substr(str.length - 6);
|
|
553
|
+
let hxa = "0" + round4(a * 255).toString(16);
|
|
554
|
+
hxa = hxa.substr(hxa.length - 2);
|
|
555
|
+
switch (mode.toLowerCase()) {
|
|
556
|
+
case "rgba":
|
|
557
|
+
return `#${str}${hxa}`;
|
|
558
|
+
case "argb":
|
|
559
|
+
return `#${hxa}${str}`;
|
|
560
|
+
default:
|
|
561
|
+
return `#${str}`;
|
|
562
|
+
}
|
|
563
|
+
};
|
|
564
|
+
var rgb2hex_default = rgb2hex;
|
|
565
|
+
|
|
566
|
+
// ../../node_modules/chroma-js/src/io/hex/index.js
|
|
567
|
+
Color_default.prototype.hex = function(mode) {
|
|
568
|
+
return rgb2hex_default(this._rgb, mode);
|
|
569
|
+
};
|
|
570
|
+
chroma_default.hex = (...args) => new Color_default(...args, "hex");
|
|
571
|
+
input_default.format.hex = hex2rgb_default;
|
|
572
|
+
input_default.autodetect.push({
|
|
573
|
+
p: 4,
|
|
574
|
+
test: (h, ...rest) => {
|
|
575
|
+
if (!rest.length && type_default(h) === "string" && [3, 4, 5, 6, 7, 8, 9].indexOf(h.length) >= 0) {
|
|
576
|
+
return "hex";
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
});
|
|
580
|
+
|
|
581
|
+
// ../../node_modules/chroma-js/src/io/hsi/hsi2rgb.js
|
|
582
|
+
var { cos } = Math;
|
|
583
|
+
var hsi2rgb = (...args) => {
|
|
584
|
+
args = unpack_default(args, "hsi");
|
|
585
|
+
let [h, s, i] = args;
|
|
586
|
+
let r, g, b;
|
|
587
|
+
if (isNaN(h)) h = 0;
|
|
588
|
+
if (isNaN(s)) s = 0;
|
|
589
|
+
if (h > 360) h -= 360;
|
|
590
|
+
if (h < 0) h += 360;
|
|
591
|
+
h /= 360;
|
|
592
|
+
if (h < 1 / 3) {
|
|
593
|
+
b = (1 - s) / 3;
|
|
594
|
+
r = (1 + s * cos(TWOPI * h) / cos(PITHIRD - TWOPI * h)) / 3;
|
|
595
|
+
g = 1 - (b + r);
|
|
596
|
+
} else if (h < 2 / 3) {
|
|
597
|
+
h -= 1 / 3;
|
|
598
|
+
r = (1 - s) / 3;
|
|
599
|
+
g = (1 + s * cos(TWOPI * h) / cos(PITHIRD - TWOPI * h)) / 3;
|
|
600
|
+
b = 1 - (r + g);
|
|
601
|
+
} else {
|
|
602
|
+
h -= 2 / 3;
|
|
603
|
+
g = (1 - s) / 3;
|
|
604
|
+
b = (1 + s * cos(TWOPI * h) / cos(PITHIRD - TWOPI * h)) / 3;
|
|
605
|
+
r = 1 - (g + b);
|
|
606
|
+
}
|
|
607
|
+
r = limit_default(i * r * 3);
|
|
608
|
+
g = limit_default(i * g * 3);
|
|
609
|
+
b = limit_default(i * b * 3);
|
|
610
|
+
return [r * 255, g * 255, b * 255, args.length > 3 ? args[3] : 1];
|
|
611
|
+
};
|
|
612
|
+
var hsi2rgb_default = hsi2rgb;
|
|
613
|
+
|
|
614
|
+
// ../../node_modules/chroma-js/src/io/hsi/rgb2hsi.js
|
|
615
|
+
var { min: min2, sqrt, acos } = Math;
|
|
616
|
+
var rgb2hsi = (...args) => {
|
|
617
|
+
let [r, g, b] = unpack_default(args, "rgb");
|
|
618
|
+
r /= 255;
|
|
619
|
+
g /= 255;
|
|
620
|
+
b /= 255;
|
|
621
|
+
let h;
|
|
622
|
+
const min_ = min2(r, g, b);
|
|
623
|
+
const i = (r + g + b) / 3;
|
|
624
|
+
const s = i > 0 ? 1 - min_ / i : 0;
|
|
625
|
+
if (s === 0) {
|
|
626
|
+
h = NaN;
|
|
627
|
+
} else {
|
|
628
|
+
h = (r - g + (r - b)) / 2;
|
|
629
|
+
h /= sqrt((r - g) * (r - g) + (r - b) * (g - b));
|
|
630
|
+
h = acos(h);
|
|
631
|
+
if (b > g) {
|
|
632
|
+
h = TWOPI - h;
|
|
633
|
+
}
|
|
634
|
+
h /= TWOPI;
|
|
635
|
+
}
|
|
636
|
+
return [h * 360, s, i];
|
|
637
|
+
};
|
|
638
|
+
var rgb2hsi_default = rgb2hsi;
|
|
639
|
+
|
|
640
|
+
// ../../node_modules/chroma-js/src/io/hsi/index.js
|
|
641
|
+
Color_default.prototype.hsi = function() {
|
|
642
|
+
return rgb2hsi_default(this._rgb);
|
|
643
|
+
};
|
|
644
|
+
chroma_default.hsi = (...args) => new Color_default(...args, "hsi");
|
|
645
|
+
input_default.format.hsi = hsi2rgb_default;
|
|
646
|
+
input_default.autodetect.push({
|
|
647
|
+
p: 2,
|
|
648
|
+
test: (...args) => {
|
|
649
|
+
args = unpack_default(args, "hsi");
|
|
650
|
+
if (type_default(args) === "array" && args.length === 3) {
|
|
651
|
+
return "hsi";
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
});
|
|
655
|
+
|
|
656
|
+
// ../../node_modules/chroma-js/src/io/hsl/index.js
|
|
657
|
+
Color_default.prototype.hsl = function() {
|
|
658
|
+
return rgb2hsl_default(this._rgb);
|
|
659
|
+
};
|
|
660
|
+
chroma_default.hsl = (...args) => new Color_default(...args, "hsl");
|
|
661
|
+
input_default.format.hsl = hsl2rgb_default;
|
|
662
|
+
input_default.autodetect.push({
|
|
663
|
+
p: 2,
|
|
664
|
+
test: (...args) => {
|
|
665
|
+
args = unpack_default(args, "hsl");
|
|
666
|
+
if (type_default(args) === "array" && args.length === 3) {
|
|
667
|
+
return "hsl";
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
});
|
|
671
|
+
|
|
672
|
+
// ../../node_modules/chroma-js/src/io/hsv/hsv2rgb.js
|
|
673
|
+
var { floor: floor2 } = Math;
|
|
674
|
+
var hsv2rgb = (...args) => {
|
|
675
|
+
args = unpack_default(args, "hsv");
|
|
676
|
+
let [h, s, v] = args;
|
|
677
|
+
let r, g, b;
|
|
678
|
+
v *= 255;
|
|
679
|
+
if (s === 0) {
|
|
680
|
+
r = g = b = v;
|
|
681
|
+
} else {
|
|
682
|
+
if (h === 360) h = 0;
|
|
683
|
+
if (h > 360) h -= 360;
|
|
684
|
+
if (h < 0) h += 360;
|
|
685
|
+
h /= 60;
|
|
686
|
+
const i = floor2(h);
|
|
687
|
+
const f = h - i;
|
|
688
|
+
const p = v * (1 - s);
|
|
689
|
+
const q = v * (1 - s * f);
|
|
690
|
+
const t = v * (1 - s * (1 - f));
|
|
691
|
+
switch (i) {
|
|
692
|
+
case 0:
|
|
693
|
+
[r, g, b] = [v, t, p];
|
|
694
|
+
break;
|
|
695
|
+
case 1:
|
|
696
|
+
[r, g, b] = [q, v, p];
|
|
697
|
+
break;
|
|
698
|
+
case 2:
|
|
699
|
+
[r, g, b] = [p, v, t];
|
|
700
|
+
break;
|
|
701
|
+
case 3:
|
|
702
|
+
[r, g, b] = [p, q, v];
|
|
703
|
+
break;
|
|
704
|
+
case 4:
|
|
705
|
+
[r, g, b] = [t, p, v];
|
|
706
|
+
break;
|
|
707
|
+
case 5:
|
|
708
|
+
[r, g, b] = [v, p, q];
|
|
709
|
+
break;
|
|
710
|
+
}
|
|
711
|
+
}
|
|
712
|
+
return [r, g, b, args.length > 3 ? args[3] : 1];
|
|
713
|
+
};
|
|
714
|
+
var hsv2rgb_default = hsv2rgb;
|
|
715
|
+
|
|
716
|
+
// ../../node_modules/chroma-js/src/io/hsv/rgb2hsv.js
|
|
717
|
+
var { min: min3, max: max3 } = Math;
|
|
718
|
+
var rgb2hsl2 = (...args) => {
|
|
719
|
+
args = unpack_default(args, "rgb");
|
|
720
|
+
let [r, g, b] = args;
|
|
721
|
+
const min_ = min3(r, g, b);
|
|
722
|
+
const max_ = max3(r, g, b);
|
|
723
|
+
const delta = max_ - min_;
|
|
724
|
+
let h, s, v;
|
|
725
|
+
v = max_ / 255;
|
|
726
|
+
if (max_ === 0) {
|
|
727
|
+
h = Number.NaN;
|
|
728
|
+
s = 0;
|
|
729
|
+
} else {
|
|
730
|
+
s = delta / max_;
|
|
731
|
+
if (r === max_) h = (g - b) / delta;
|
|
732
|
+
if (g === max_) h = 2 + (b - r) / delta;
|
|
733
|
+
if (b === max_) h = 4 + (r - g) / delta;
|
|
734
|
+
h *= 60;
|
|
735
|
+
if (h < 0) h += 360;
|
|
736
|
+
}
|
|
737
|
+
return [h, s, v];
|
|
738
|
+
};
|
|
739
|
+
var rgb2hsv_default = rgb2hsl2;
|
|
740
|
+
|
|
741
|
+
// ../../node_modules/chroma-js/src/io/hsv/index.js
|
|
742
|
+
Color_default.prototype.hsv = function() {
|
|
743
|
+
return rgb2hsv_default(this._rgb);
|
|
744
|
+
};
|
|
745
|
+
chroma_default.hsv = (...args) => new Color_default(...args, "hsv");
|
|
746
|
+
input_default.format.hsv = hsv2rgb_default;
|
|
747
|
+
input_default.autodetect.push({
|
|
748
|
+
p: 2,
|
|
749
|
+
test: (...args) => {
|
|
750
|
+
args = unpack_default(args, "hsv");
|
|
751
|
+
if (type_default(args) === "array" && args.length === 3) {
|
|
752
|
+
return "hsv";
|
|
753
|
+
}
|
|
754
|
+
}
|
|
755
|
+
});
|
|
756
|
+
|
|
757
|
+
// ../../node_modules/chroma-js/src/io/lab/lab-constants.js
|
|
758
|
+
var lab_constants_default = {
|
|
759
|
+
// Corresponds roughly to RGB brighter/darker
|
|
760
|
+
Kn: 18,
|
|
761
|
+
// D65 standard referent
|
|
762
|
+
Xn: 0.95047,
|
|
763
|
+
Yn: 1,
|
|
764
|
+
Zn: 1.08883,
|
|
765
|
+
t0: 0.137931034,
|
|
766
|
+
// 4 / 29
|
|
767
|
+
t1: 0.206896552,
|
|
768
|
+
// 6 / 29
|
|
769
|
+
t2: 0.12841855,
|
|
770
|
+
// 3 * t1 * t1
|
|
771
|
+
t3: 8856452e-9
|
|
772
|
+
// t1 * t1 * t1
|
|
773
|
+
};
|
|
774
|
+
|
|
775
|
+
// ../../node_modules/chroma-js/src/io/lab/lab2rgb.js
|
|
776
|
+
var { pow } = Math;
|
|
777
|
+
var lab2rgb = (...args) => {
|
|
778
|
+
args = unpack_default(args, "lab");
|
|
779
|
+
const [l, a, b] = args;
|
|
780
|
+
let x, y, z, r, g, b_;
|
|
781
|
+
y = (l + 16) / 116;
|
|
782
|
+
x = isNaN(a) ? y : y + a / 500;
|
|
783
|
+
z = isNaN(b) ? y : y - b / 200;
|
|
784
|
+
y = lab_constants_default.Yn * lab_xyz(y);
|
|
785
|
+
x = lab_constants_default.Xn * lab_xyz(x);
|
|
786
|
+
z = lab_constants_default.Zn * lab_xyz(z);
|
|
787
|
+
r = xyz_rgb(3.2404542 * x - 1.5371385 * y - 0.4985314 * z);
|
|
788
|
+
g = xyz_rgb(-0.969266 * x + 1.8760108 * y + 0.041556 * z);
|
|
789
|
+
b_ = xyz_rgb(0.0556434 * x - 0.2040259 * y + 1.0572252 * z);
|
|
790
|
+
return [r, g, b_, args.length > 3 ? args[3] : 1];
|
|
791
|
+
};
|
|
792
|
+
var xyz_rgb = (r) => {
|
|
793
|
+
return 255 * (r <= 304e-5 ? 12.92 * r : 1.055 * pow(r, 1 / 2.4) - 0.055);
|
|
794
|
+
};
|
|
795
|
+
var lab_xyz = (t) => {
|
|
796
|
+
return t > lab_constants_default.t1 ? t * t * t : lab_constants_default.t2 * (t - lab_constants_default.t0);
|
|
797
|
+
};
|
|
798
|
+
var lab2rgb_default = lab2rgb;
|
|
799
|
+
|
|
800
|
+
// ../../node_modules/chroma-js/src/io/lab/rgb2lab.js
|
|
801
|
+
var { pow: pow2 } = Math;
|
|
802
|
+
var rgb2lab = (...args) => {
|
|
803
|
+
const [r, g, b] = unpack_default(args, "rgb");
|
|
804
|
+
const [x, y, z] = rgb2xyz(r, g, b);
|
|
805
|
+
const l = 116 * y - 16;
|
|
806
|
+
return [l < 0 ? 0 : l, 500 * (x - y), 200 * (y - z)];
|
|
807
|
+
};
|
|
808
|
+
var rgb_xyz = (r) => {
|
|
809
|
+
if ((r /= 255) <= 0.04045) return r / 12.92;
|
|
810
|
+
return pow2((r + 0.055) / 1.055, 2.4);
|
|
811
|
+
};
|
|
812
|
+
var xyz_lab = (t) => {
|
|
813
|
+
if (t > lab_constants_default.t3) return pow2(t, 1 / 3);
|
|
814
|
+
return t / lab_constants_default.t2 + lab_constants_default.t0;
|
|
815
|
+
};
|
|
816
|
+
var rgb2xyz = (r, g, b) => {
|
|
817
|
+
r = rgb_xyz(r);
|
|
818
|
+
g = rgb_xyz(g);
|
|
819
|
+
b = rgb_xyz(b);
|
|
820
|
+
const x = xyz_lab(
|
|
821
|
+
(0.4124564 * r + 0.3575761 * g + 0.1804375 * b) / lab_constants_default.Xn
|
|
822
|
+
);
|
|
823
|
+
const y = xyz_lab(
|
|
824
|
+
(0.2126729 * r + 0.7151522 * g + 0.072175 * b) / lab_constants_default.Yn
|
|
825
|
+
);
|
|
826
|
+
const z = xyz_lab(
|
|
827
|
+
(0.0193339 * r + 0.119192 * g + 0.9503041 * b) / lab_constants_default.Zn
|
|
828
|
+
);
|
|
829
|
+
return [x, y, z];
|
|
830
|
+
};
|
|
831
|
+
var rgb2lab_default = rgb2lab;
|
|
832
|
+
|
|
833
|
+
// ../../node_modules/chroma-js/src/io/lab/index.js
|
|
834
|
+
Color_default.prototype.lab = function() {
|
|
835
|
+
return rgb2lab_default(this._rgb);
|
|
836
|
+
};
|
|
837
|
+
chroma_default.lab = (...args) => new Color_default(...args, "lab");
|
|
838
|
+
input_default.format.lab = lab2rgb_default;
|
|
839
|
+
input_default.autodetect.push({
|
|
840
|
+
p: 2,
|
|
841
|
+
test: (...args) => {
|
|
842
|
+
args = unpack_default(args, "lab");
|
|
843
|
+
if (type_default(args) === "array" && args.length === 3) {
|
|
844
|
+
return "lab";
|
|
845
|
+
}
|
|
846
|
+
}
|
|
847
|
+
});
|
|
848
|
+
|
|
849
|
+
// ../../node_modules/chroma-js/src/io/lch/lch2lab.js
|
|
850
|
+
var { sin, cos: cos2 } = Math;
|
|
851
|
+
var lch2lab = (...args) => {
|
|
852
|
+
let [l, c, h] = unpack_default(args, "lch");
|
|
853
|
+
if (isNaN(h)) h = 0;
|
|
854
|
+
h = h * DEG2RAD;
|
|
855
|
+
return [l, cos2(h) * c, sin(h) * c];
|
|
856
|
+
};
|
|
857
|
+
var lch2lab_default = lch2lab;
|
|
858
|
+
|
|
859
|
+
// ../../node_modules/chroma-js/src/io/lch/lch2rgb.js
|
|
860
|
+
var lch2rgb = (...args) => {
|
|
861
|
+
args = unpack_default(args, "lch");
|
|
862
|
+
const [l, c, h] = args;
|
|
863
|
+
const [L, a, b_] = lch2lab_default(l, c, h);
|
|
864
|
+
const [r, g, b] = lab2rgb_default(L, a, b_);
|
|
865
|
+
return [r, g, b, args.length > 3 ? args[3] : 1];
|
|
866
|
+
};
|
|
867
|
+
var lch2rgb_default = lch2rgb;
|
|
868
|
+
|
|
869
|
+
// ../../node_modules/chroma-js/src/io/lch/hcl2rgb.js
|
|
870
|
+
var hcl2rgb = (...args) => {
|
|
871
|
+
const hcl = unpack_default(args, "hcl").reverse();
|
|
872
|
+
return lch2rgb_default(...hcl);
|
|
873
|
+
};
|
|
874
|
+
var hcl2rgb_default = hcl2rgb;
|
|
875
|
+
|
|
876
|
+
// ../../node_modules/chroma-js/src/io/lch/lab2lch.js
|
|
877
|
+
var { sqrt: sqrt2, atan2, round: round5 } = Math;
|
|
878
|
+
var lab2lch = (...args) => {
|
|
879
|
+
const [l, a, b] = unpack_default(args, "lab");
|
|
880
|
+
const c = sqrt2(a * a + b * b);
|
|
881
|
+
let h = (atan2(b, a) * RAD2DEG + 360) % 360;
|
|
882
|
+
if (round5(c * 1e4) === 0) h = Number.NaN;
|
|
883
|
+
return [l, c, h];
|
|
884
|
+
};
|
|
885
|
+
var lab2lch_default = lab2lch;
|
|
886
|
+
|
|
887
|
+
// ../../node_modules/chroma-js/src/io/lch/rgb2lch.js
|
|
888
|
+
var rgb2lch = (...args) => {
|
|
889
|
+
const [r, g, b] = unpack_default(args, "rgb");
|
|
890
|
+
const [l, a, b_] = rgb2lab_default(r, g, b);
|
|
891
|
+
return lab2lch_default(l, a, b_);
|
|
892
|
+
};
|
|
893
|
+
var rgb2lch_default = rgb2lch;
|
|
894
|
+
|
|
895
|
+
// ../../node_modules/chroma-js/src/io/lch/index.js
|
|
896
|
+
Color_default.prototype.lch = function() {
|
|
897
|
+
return rgb2lch_default(this._rgb);
|
|
898
|
+
};
|
|
899
|
+
Color_default.prototype.hcl = function() {
|
|
900
|
+
return rgb2lch_default(this._rgb).reverse();
|
|
901
|
+
};
|
|
902
|
+
chroma_default.lch = (...args) => new Color_default(...args, "lch");
|
|
903
|
+
chroma_default.hcl = (...args) => new Color_default(...args, "hcl");
|
|
904
|
+
input_default.format.lch = lch2rgb_default;
|
|
905
|
+
input_default.format.hcl = hcl2rgb_default;
|
|
906
|
+
["lch", "hcl"].forEach(
|
|
907
|
+
(m) => input_default.autodetect.push({
|
|
908
|
+
p: 2,
|
|
909
|
+
test: (...args) => {
|
|
910
|
+
args = unpack_default(args, m);
|
|
911
|
+
if (type_default(args) === "array" && args.length === 3) {
|
|
912
|
+
return m;
|
|
913
|
+
}
|
|
914
|
+
}
|
|
915
|
+
})
|
|
916
|
+
);
|
|
917
|
+
|
|
918
|
+
// ../../node_modules/chroma-js/src/colors/w3cx11.js
|
|
919
|
+
var w3cx11 = {
|
|
920
|
+
aliceblue: "#f0f8ff",
|
|
921
|
+
antiquewhite: "#faebd7",
|
|
922
|
+
aqua: "#00ffff",
|
|
923
|
+
aquamarine: "#7fffd4",
|
|
924
|
+
azure: "#f0ffff",
|
|
925
|
+
beige: "#f5f5dc",
|
|
926
|
+
bisque: "#ffe4c4",
|
|
927
|
+
black: "#000000",
|
|
928
|
+
blanchedalmond: "#ffebcd",
|
|
929
|
+
blue: "#0000ff",
|
|
930
|
+
blueviolet: "#8a2be2",
|
|
931
|
+
brown: "#a52a2a",
|
|
932
|
+
burlywood: "#deb887",
|
|
933
|
+
cadetblue: "#5f9ea0",
|
|
934
|
+
chartreuse: "#7fff00",
|
|
935
|
+
chocolate: "#d2691e",
|
|
936
|
+
coral: "#ff7f50",
|
|
937
|
+
cornflowerblue: "#6495ed",
|
|
938
|
+
cornsilk: "#fff8dc",
|
|
939
|
+
crimson: "#dc143c",
|
|
940
|
+
cyan: "#00ffff",
|
|
941
|
+
darkblue: "#00008b",
|
|
942
|
+
darkcyan: "#008b8b",
|
|
943
|
+
darkgoldenrod: "#b8860b",
|
|
944
|
+
darkgray: "#a9a9a9",
|
|
945
|
+
darkgreen: "#006400",
|
|
946
|
+
darkgrey: "#a9a9a9",
|
|
947
|
+
darkkhaki: "#bdb76b",
|
|
948
|
+
darkmagenta: "#8b008b",
|
|
949
|
+
darkolivegreen: "#556b2f",
|
|
950
|
+
darkorange: "#ff8c00",
|
|
951
|
+
darkorchid: "#9932cc",
|
|
952
|
+
darkred: "#8b0000",
|
|
953
|
+
darksalmon: "#e9967a",
|
|
954
|
+
darkseagreen: "#8fbc8f",
|
|
955
|
+
darkslateblue: "#483d8b",
|
|
956
|
+
darkslategray: "#2f4f4f",
|
|
957
|
+
darkslategrey: "#2f4f4f",
|
|
958
|
+
darkturquoise: "#00ced1",
|
|
959
|
+
darkviolet: "#9400d3",
|
|
960
|
+
deeppink: "#ff1493",
|
|
961
|
+
deepskyblue: "#00bfff",
|
|
962
|
+
dimgray: "#696969",
|
|
963
|
+
dimgrey: "#696969",
|
|
964
|
+
dodgerblue: "#1e90ff",
|
|
965
|
+
firebrick: "#b22222",
|
|
966
|
+
floralwhite: "#fffaf0",
|
|
967
|
+
forestgreen: "#228b22",
|
|
968
|
+
fuchsia: "#ff00ff",
|
|
969
|
+
gainsboro: "#dcdcdc",
|
|
970
|
+
ghostwhite: "#f8f8ff",
|
|
971
|
+
gold: "#ffd700",
|
|
972
|
+
goldenrod: "#daa520",
|
|
973
|
+
gray: "#808080",
|
|
974
|
+
green: "#008000",
|
|
975
|
+
greenyellow: "#adff2f",
|
|
976
|
+
grey: "#808080",
|
|
977
|
+
honeydew: "#f0fff0",
|
|
978
|
+
hotpink: "#ff69b4",
|
|
979
|
+
indianred: "#cd5c5c",
|
|
980
|
+
indigo: "#4b0082",
|
|
981
|
+
ivory: "#fffff0",
|
|
982
|
+
khaki: "#f0e68c",
|
|
983
|
+
laserlemon: "#ffff54",
|
|
984
|
+
lavender: "#e6e6fa",
|
|
985
|
+
lavenderblush: "#fff0f5",
|
|
986
|
+
lawngreen: "#7cfc00",
|
|
987
|
+
lemonchiffon: "#fffacd",
|
|
988
|
+
lightblue: "#add8e6",
|
|
989
|
+
lightcoral: "#f08080",
|
|
990
|
+
lightcyan: "#e0ffff",
|
|
991
|
+
lightgoldenrod: "#fafad2",
|
|
992
|
+
lightgoldenrodyellow: "#fafad2",
|
|
993
|
+
lightgray: "#d3d3d3",
|
|
994
|
+
lightgreen: "#90ee90",
|
|
995
|
+
lightgrey: "#d3d3d3",
|
|
996
|
+
lightpink: "#ffb6c1",
|
|
997
|
+
lightsalmon: "#ffa07a",
|
|
998
|
+
lightseagreen: "#20b2aa",
|
|
999
|
+
lightskyblue: "#87cefa",
|
|
1000
|
+
lightslategray: "#778899",
|
|
1001
|
+
lightslategrey: "#778899",
|
|
1002
|
+
lightsteelblue: "#b0c4de",
|
|
1003
|
+
lightyellow: "#ffffe0",
|
|
1004
|
+
lime: "#00ff00",
|
|
1005
|
+
limegreen: "#32cd32",
|
|
1006
|
+
linen: "#faf0e6",
|
|
1007
|
+
magenta: "#ff00ff",
|
|
1008
|
+
maroon: "#800000",
|
|
1009
|
+
maroon2: "#7f0000",
|
|
1010
|
+
maroon3: "#b03060",
|
|
1011
|
+
mediumaquamarine: "#66cdaa",
|
|
1012
|
+
mediumblue: "#0000cd",
|
|
1013
|
+
mediumorchid: "#ba55d3",
|
|
1014
|
+
mediumpurple: "#9370db",
|
|
1015
|
+
mediumseagreen: "#3cb371",
|
|
1016
|
+
mediumslateblue: "#7b68ee",
|
|
1017
|
+
mediumspringgreen: "#00fa9a",
|
|
1018
|
+
mediumturquoise: "#48d1cc",
|
|
1019
|
+
mediumvioletred: "#c71585",
|
|
1020
|
+
midnightblue: "#191970",
|
|
1021
|
+
mintcream: "#f5fffa",
|
|
1022
|
+
mistyrose: "#ffe4e1",
|
|
1023
|
+
moccasin: "#ffe4b5",
|
|
1024
|
+
navajowhite: "#ffdead",
|
|
1025
|
+
navy: "#000080",
|
|
1026
|
+
oldlace: "#fdf5e6",
|
|
1027
|
+
olive: "#808000",
|
|
1028
|
+
olivedrab: "#6b8e23",
|
|
1029
|
+
orange: "#ffa500",
|
|
1030
|
+
orangered: "#ff4500",
|
|
1031
|
+
orchid: "#da70d6",
|
|
1032
|
+
palegoldenrod: "#eee8aa",
|
|
1033
|
+
palegreen: "#98fb98",
|
|
1034
|
+
paleturquoise: "#afeeee",
|
|
1035
|
+
palevioletred: "#db7093",
|
|
1036
|
+
papayawhip: "#ffefd5",
|
|
1037
|
+
peachpuff: "#ffdab9",
|
|
1038
|
+
peru: "#cd853f",
|
|
1039
|
+
pink: "#ffc0cb",
|
|
1040
|
+
plum: "#dda0dd",
|
|
1041
|
+
powderblue: "#b0e0e6",
|
|
1042
|
+
purple: "#800080",
|
|
1043
|
+
purple2: "#7f007f",
|
|
1044
|
+
purple3: "#a020f0",
|
|
1045
|
+
rebeccapurple: "#663399",
|
|
1046
|
+
red: "#ff0000",
|
|
1047
|
+
rosybrown: "#bc8f8f",
|
|
1048
|
+
royalblue: "#4169e1",
|
|
1049
|
+
saddlebrown: "#8b4513",
|
|
1050
|
+
salmon: "#fa8072",
|
|
1051
|
+
sandybrown: "#f4a460",
|
|
1052
|
+
seagreen: "#2e8b57",
|
|
1053
|
+
seashell: "#fff5ee",
|
|
1054
|
+
sienna: "#a0522d",
|
|
1055
|
+
silver: "#c0c0c0",
|
|
1056
|
+
skyblue: "#87ceeb",
|
|
1057
|
+
slateblue: "#6a5acd",
|
|
1058
|
+
slategray: "#708090",
|
|
1059
|
+
slategrey: "#708090",
|
|
1060
|
+
snow: "#fffafa",
|
|
1061
|
+
springgreen: "#00ff7f",
|
|
1062
|
+
steelblue: "#4682b4",
|
|
1063
|
+
tan: "#d2b48c",
|
|
1064
|
+
teal: "#008080",
|
|
1065
|
+
thistle: "#d8bfd8",
|
|
1066
|
+
tomato: "#ff6347",
|
|
1067
|
+
turquoise: "#40e0d0",
|
|
1068
|
+
violet: "#ee82ee",
|
|
1069
|
+
wheat: "#f5deb3",
|
|
1070
|
+
white: "#ffffff",
|
|
1071
|
+
whitesmoke: "#f5f5f5",
|
|
1072
|
+
yellow: "#ffff00",
|
|
1073
|
+
yellowgreen: "#9acd32"
|
|
1074
|
+
};
|
|
1075
|
+
var w3cx11_default = w3cx11;
|
|
1076
|
+
|
|
1077
|
+
// ../../node_modules/chroma-js/src/io/named/index.js
|
|
1078
|
+
Color_default.prototype.name = function() {
|
|
1079
|
+
const hex = rgb2hex_default(this._rgb, "rgb");
|
|
1080
|
+
for (let n of Object.keys(w3cx11_default)) {
|
|
1081
|
+
if (w3cx11_default[n] === hex) return n.toLowerCase();
|
|
1082
|
+
}
|
|
1083
|
+
return hex;
|
|
1084
|
+
};
|
|
1085
|
+
input_default.format.named = (name) => {
|
|
1086
|
+
name = name.toLowerCase();
|
|
1087
|
+
if (w3cx11_default[name]) return hex2rgb_default(w3cx11_default[name]);
|
|
1088
|
+
throw new Error("unknown color name: " + name);
|
|
1089
|
+
};
|
|
1090
|
+
input_default.autodetect.push({
|
|
1091
|
+
p: 5,
|
|
1092
|
+
test: (h, ...rest) => {
|
|
1093
|
+
if (!rest.length && type_default(h) === "string" && w3cx11_default[h.toLowerCase()]) {
|
|
1094
|
+
return "named";
|
|
1095
|
+
}
|
|
1096
|
+
}
|
|
1097
|
+
});
|
|
1098
|
+
|
|
1099
|
+
// ../../node_modules/chroma-js/src/io/num/num2rgb.js
|
|
1100
|
+
var num2rgb = (num2) => {
|
|
1101
|
+
if (type_default(num2) == "number" && num2 >= 0 && num2 <= 16777215) {
|
|
1102
|
+
const r = num2 >> 16;
|
|
1103
|
+
const g = num2 >> 8 & 255;
|
|
1104
|
+
const b = num2 & 255;
|
|
1105
|
+
return [r, g, b, 1];
|
|
1106
|
+
}
|
|
1107
|
+
throw new Error("unknown num color: " + num2);
|
|
1108
|
+
};
|
|
1109
|
+
var num2rgb_default = num2rgb;
|
|
1110
|
+
|
|
1111
|
+
// ../../node_modules/chroma-js/src/io/num/rgb2num.js
|
|
1112
|
+
var rgb2num = (...args) => {
|
|
1113
|
+
const [r, g, b] = unpack_default(args, "rgb");
|
|
1114
|
+
return (r << 16) + (g << 8) + b;
|
|
1115
|
+
};
|
|
1116
|
+
var rgb2num_default = rgb2num;
|
|
1117
|
+
|
|
1118
|
+
// ../../node_modules/chroma-js/src/io/num/index.js
|
|
1119
|
+
Color_default.prototype.num = function() {
|
|
1120
|
+
return rgb2num_default(this._rgb);
|
|
1121
|
+
};
|
|
1122
|
+
chroma_default.num = (...args) => new Color_default(...args, "num");
|
|
1123
|
+
input_default.format.num = num2rgb_default;
|
|
1124
|
+
input_default.autodetect.push({
|
|
1125
|
+
p: 5,
|
|
1126
|
+
test: (...args) => {
|
|
1127
|
+
if (args.length === 1 && type_default(args[0]) === "number" && args[0] >= 0 && args[0] <= 16777215) {
|
|
1128
|
+
return "num";
|
|
1129
|
+
}
|
|
1130
|
+
}
|
|
1131
|
+
});
|
|
1132
|
+
|
|
1133
|
+
// ../../node_modules/chroma-js/src/io/rgb/index.js
|
|
1134
|
+
var { round: round6 } = Math;
|
|
1135
|
+
Color_default.prototype.rgb = function(rnd2 = true) {
|
|
1136
|
+
if (rnd2 === false) return this._rgb.slice(0, 3);
|
|
1137
|
+
return this._rgb.slice(0, 3).map(round6);
|
|
1138
|
+
};
|
|
1139
|
+
Color_default.prototype.rgba = function(rnd2 = true) {
|
|
1140
|
+
return this._rgb.slice(0, 4).map((v, i) => {
|
|
1141
|
+
return i < 3 ? rnd2 === false ? v : round6(v) : v;
|
|
1142
|
+
});
|
|
1143
|
+
};
|
|
1144
|
+
chroma_default.rgb = (...args) => new Color_default(...args, "rgb");
|
|
1145
|
+
input_default.format.rgb = (...args) => {
|
|
1146
|
+
const rgba = unpack_default(args, "rgba");
|
|
1147
|
+
if (rgba[3] === void 0) rgba[3] = 1;
|
|
1148
|
+
return rgba;
|
|
1149
|
+
};
|
|
1150
|
+
input_default.autodetect.push({
|
|
1151
|
+
p: 3,
|
|
1152
|
+
test: (...args) => {
|
|
1153
|
+
args = unpack_default(args, "rgba");
|
|
1154
|
+
if (type_default(args) === "array" && (args.length === 3 || args.length === 4 && type_default(args[3]) == "number" && args[3] >= 0 && args[3] <= 1)) {
|
|
1155
|
+
return "rgb";
|
|
1156
|
+
}
|
|
1157
|
+
}
|
|
1158
|
+
});
|
|
1159
|
+
|
|
1160
|
+
// ../../node_modules/chroma-js/src/io/temp/temperature2rgb.js
|
|
1161
|
+
var { log } = Math;
|
|
1162
|
+
var temperature2rgb = (kelvin) => {
|
|
1163
|
+
const temp = kelvin / 100;
|
|
1164
|
+
let r, g, b;
|
|
1165
|
+
if (temp < 66) {
|
|
1166
|
+
r = 255;
|
|
1167
|
+
g = temp < 6 ? 0 : -155.25485562709179 - 0.44596950469579133 * (g = temp - 2) + 104.49216199393888 * log(g);
|
|
1168
|
+
b = temp < 20 ? 0 : -254.76935184120902 + 0.8274096064007395 * (b = temp - 10) + 115.67994401066147 * log(b);
|
|
1169
|
+
} else {
|
|
1170
|
+
r = 351.97690566805693 + 0.114206453784165 * (r = temp - 55) - 40.25366309332127 * log(r);
|
|
1171
|
+
g = 325.4494125711974 + 0.07943456536662342 * (g = temp - 50) - 28.0852963507957 * log(g);
|
|
1172
|
+
b = 255;
|
|
1173
|
+
}
|
|
1174
|
+
return [r, g, b, 1];
|
|
1175
|
+
};
|
|
1176
|
+
var temperature2rgb_default = temperature2rgb;
|
|
1177
|
+
|
|
1178
|
+
// ../../node_modules/chroma-js/src/io/temp/rgb2temperature.js
|
|
1179
|
+
var { round: round7 } = Math;
|
|
1180
|
+
var rgb2temperature = (...args) => {
|
|
1181
|
+
const rgb2 = unpack_default(args, "rgb");
|
|
1182
|
+
const r = rgb2[0], b = rgb2[2];
|
|
1183
|
+
let minTemp = 1e3;
|
|
1184
|
+
let maxTemp = 4e4;
|
|
1185
|
+
const eps = 0.4;
|
|
1186
|
+
let temp;
|
|
1187
|
+
while (maxTemp - minTemp > eps) {
|
|
1188
|
+
temp = (maxTemp + minTemp) * 0.5;
|
|
1189
|
+
const rgb3 = temperature2rgb_default(temp);
|
|
1190
|
+
if (rgb3[2] / rgb3[0] >= b / r) {
|
|
1191
|
+
maxTemp = temp;
|
|
1192
|
+
} else {
|
|
1193
|
+
minTemp = temp;
|
|
1194
|
+
}
|
|
1195
|
+
}
|
|
1196
|
+
return round7(temp);
|
|
1197
|
+
};
|
|
1198
|
+
var rgb2temperature_default = rgb2temperature;
|
|
1199
|
+
|
|
1200
|
+
// ../../node_modules/chroma-js/src/io/temp/index.js
|
|
1201
|
+
Color_default.prototype.temp = Color_default.prototype.kelvin = Color_default.prototype.temperature = function() {
|
|
1202
|
+
return rgb2temperature_default(this._rgb);
|
|
1203
|
+
};
|
|
1204
|
+
chroma_default.temp = chroma_default.kelvin = chroma_default.temperature = (...args) => new Color_default(...args, "temp");
|
|
1205
|
+
input_default.format.temp = input_default.format.kelvin = input_default.format.temperature = temperature2rgb_default;
|
|
1206
|
+
|
|
1207
|
+
// ../../node_modules/chroma-js/src/io/oklab/oklab2rgb.js
|
|
1208
|
+
var { pow: pow3, sign } = Math;
|
|
1209
|
+
var oklab2rgb = (...args) => {
|
|
1210
|
+
args = unpack_default(args, "lab");
|
|
1211
|
+
const [L, a, b] = args;
|
|
1212
|
+
const l = pow3(L + 0.3963377774 * a + 0.2158037573 * b, 3);
|
|
1213
|
+
const m = pow3(L - 0.1055613458 * a - 0.0638541728 * b, 3);
|
|
1214
|
+
const s = pow3(L - 0.0894841775 * a - 1.291485548 * b, 3);
|
|
1215
|
+
return [
|
|
1216
|
+
255 * lrgb2rgb(4.0767416621 * l - 3.3077115913 * m + 0.2309699292 * s),
|
|
1217
|
+
255 * lrgb2rgb(-1.2684380046 * l + 2.6097574011 * m - 0.3413193965 * s),
|
|
1218
|
+
255 * lrgb2rgb(-0.0041960863 * l - 0.7034186147 * m + 1.707614701 * s),
|
|
1219
|
+
args.length > 3 ? args[3] : 1
|
|
1220
|
+
];
|
|
1221
|
+
};
|
|
1222
|
+
var oklab2rgb_default = oklab2rgb;
|
|
1223
|
+
function lrgb2rgb(c) {
|
|
1224
|
+
const abs3 = Math.abs(c);
|
|
1225
|
+
if (abs3 > 31308e-7) {
|
|
1226
|
+
return (sign(c) || 1) * (1.055 * pow3(abs3, 1 / 2.4) - 0.055);
|
|
1227
|
+
}
|
|
1228
|
+
return c * 12.92;
|
|
1229
|
+
}
|
|
1230
|
+
|
|
1231
|
+
// ../../node_modules/chroma-js/src/io/oklab/rgb2oklab.js
|
|
1232
|
+
var { cbrt, pow: pow4, sign: sign2 } = Math;
|
|
1233
|
+
var rgb2oklab = (...args) => {
|
|
1234
|
+
const [r, g, b] = unpack_default(args, "rgb");
|
|
1235
|
+
const [lr, lg, lb] = [
|
|
1236
|
+
rgb2lrgb(r / 255),
|
|
1237
|
+
rgb2lrgb(g / 255),
|
|
1238
|
+
rgb2lrgb(b / 255)
|
|
1239
|
+
];
|
|
1240
|
+
const l = cbrt(0.4122214708 * lr + 0.5363325363 * lg + 0.0514459929 * lb);
|
|
1241
|
+
const m = cbrt(0.2119034982 * lr + 0.6806995451 * lg + 0.1073969566 * lb);
|
|
1242
|
+
const s = cbrt(0.0883024619 * lr + 0.2817188376 * lg + 0.6299787005 * lb);
|
|
1243
|
+
return [
|
|
1244
|
+
0.2104542553 * l + 0.793617785 * m - 0.0040720468 * s,
|
|
1245
|
+
1.9779984951 * l - 2.428592205 * m + 0.4505937099 * s,
|
|
1246
|
+
0.0259040371 * l + 0.7827717662 * m - 0.808675766 * s
|
|
1247
|
+
];
|
|
1248
|
+
};
|
|
1249
|
+
var rgb2oklab_default = rgb2oklab;
|
|
1250
|
+
function rgb2lrgb(c) {
|
|
1251
|
+
const abs3 = Math.abs(c);
|
|
1252
|
+
if (abs3 < 0.04045) {
|
|
1253
|
+
return c / 12.92;
|
|
1254
|
+
}
|
|
1255
|
+
return (sign2(c) || 1) * pow4((abs3 + 0.055) / 1.055, 2.4);
|
|
1256
|
+
}
|
|
1257
|
+
|
|
1258
|
+
// ../../node_modules/chroma-js/src/io/oklab/index.js
|
|
1259
|
+
Color_default.prototype.oklab = function() {
|
|
1260
|
+
return rgb2oklab_default(this._rgb);
|
|
1261
|
+
};
|
|
1262
|
+
chroma_default.oklab = (...args) => new Color_default(...args, "oklab");
|
|
1263
|
+
input_default.format.oklab = oklab2rgb_default;
|
|
1264
|
+
input_default.autodetect.push({
|
|
1265
|
+
p: 3,
|
|
1266
|
+
test: (...args) => {
|
|
1267
|
+
args = unpack_default(args, "oklab");
|
|
1268
|
+
if (type_default(args) === "array" && args.length === 3) {
|
|
1269
|
+
return "oklab";
|
|
1270
|
+
}
|
|
1271
|
+
}
|
|
1272
|
+
});
|
|
1273
|
+
|
|
1274
|
+
// ../../node_modules/chroma-js/src/io/oklch/oklch2rgb.js
|
|
1275
|
+
var oklch2rgb = (...args) => {
|
|
1276
|
+
args = unpack_default(args, "lch");
|
|
1277
|
+
const [l, c, h] = args;
|
|
1278
|
+
const [L, a, b_] = lch2lab_default(l, c, h);
|
|
1279
|
+
const [r, g, b] = oklab2rgb_default(L, a, b_);
|
|
1280
|
+
return [r, g, b, args.length > 3 ? args[3] : 1];
|
|
1281
|
+
};
|
|
1282
|
+
var oklch2rgb_default = oklch2rgb;
|
|
1283
|
+
|
|
1284
|
+
// ../../node_modules/chroma-js/src/io/oklch/rgb2oklch.js
|
|
1285
|
+
var rgb2oklch = (...args) => {
|
|
1286
|
+
const [r, g, b] = unpack_default(args, "rgb");
|
|
1287
|
+
const [l, a, b_] = rgb2oklab_default(r, g, b);
|
|
1288
|
+
return lab2lch_default(l, a, b_);
|
|
1289
|
+
};
|
|
1290
|
+
var rgb2oklch_default = rgb2oklch;
|
|
1291
|
+
|
|
1292
|
+
// ../../node_modules/chroma-js/src/io/oklch/index.js
|
|
1293
|
+
Color_default.prototype.oklch = function() {
|
|
1294
|
+
return rgb2oklch_default(this._rgb);
|
|
1295
|
+
};
|
|
1296
|
+
chroma_default.oklch = (...args) => new Color_default(...args, "oklch");
|
|
1297
|
+
input_default.format.oklch = oklch2rgb_default;
|
|
1298
|
+
input_default.autodetect.push({
|
|
1299
|
+
p: 3,
|
|
1300
|
+
test: (...args) => {
|
|
1301
|
+
args = unpack_default(args, "oklch");
|
|
1302
|
+
if (type_default(args) === "array" && args.length === 3) {
|
|
1303
|
+
return "oklch";
|
|
1304
|
+
}
|
|
1305
|
+
}
|
|
1306
|
+
});
|
|
1307
|
+
|
|
1308
|
+
// ../../node_modules/chroma-js/src/ops/alpha.js
|
|
1309
|
+
Color_default.prototype.alpha = function(a, mutate = false) {
|
|
1310
|
+
if (a !== void 0 && type_default(a) === "number") {
|
|
1311
|
+
if (mutate) {
|
|
1312
|
+
this._rgb[3] = a;
|
|
1313
|
+
return this;
|
|
1314
|
+
}
|
|
1315
|
+
return new Color_default([this._rgb[0], this._rgb[1], this._rgb[2], a], "rgb");
|
|
1316
|
+
}
|
|
1317
|
+
return this._rgb[3];
|
|
1318
|
+
};
|
|
1319
|
+
|
|
1320
|
+
// ../../node_modules/chroma-js/src/ops/clipped.js
|
|
1321
|
+
Color_default.prototype.clipped = function() {
|
|
1322
|
+
return this._rgb._clipped || false;
|
|
1323
|
+
};
|
|
1324
|
+
|
|
1325
|
+
// ../../node_modules/chroma-js/src/ops/darken.js
|
|
1326
|
+
Color_default.prototype.darken = function(amount = 1) {
|
|
1327
|
+
const me = this;
|
|
1328
|
+
const lab2 = me.lab();
|
|
1329
|
+
lab2[0] -= lab_constants_default.Kn * amount;
|
|
1330
|
+
return new Color_default(lab2, "lab").alpha(me.alpha(), true);
|
|
1331
|
+
};
|
|
1332
|
+
Color_default.prototype.brighten = function(amount = 1) {
|
|
1333
|
+
return this.darken(-amount);
|
|
1334
|
+
};
|
|
1335
|
+
Color_default.prototype.darker = Color_default.prototype.darken;
|
|
1336
|
+
Color_default.prototype.brighter = Color_default.prototype.brighten;
|
|
1337
|
+
|
|
1338
|
+
// ../../node_modules/chroma-js/src/ops/get.js
|
|
1339
|
+
Color_default.prototype.get = function(mc) {
|
|
1340
|
+
const [mode, channel] = mc.split(".");
|
|
1341
|
+
const src = this[mode]();
|
|
1342
|
+
if (channel) {
|
|
1343
|
+
const i = mode.indexOf(channel) - (mode.substr(0, 2) === "ok" ? 2 : 0);
|
|
1344
|
+
if (i > -1) return src[i];
|
|
1345
|
+
throw new Error(`unknown channel ${channel} in mode ${mode}`);
|
|
1346
|
+
} else {
|
|
1347
|
+
return src;
|
|
1348
|
+
}
|
|
1349
|
+
};
|
|
1350
|
+
|
|
1351
|
+
// ../../node_modules/chroma-js/src/ops/luminance.js
|
|
1352
|
+
var { pow: pow5 } = Math;
|
|
1353
|
+
var EPS = 1e-7;
|
|
1354
|
+
var MAX_ITER = 20;
|
|
1355
|
+
Color_default.prototype.luminance = function(lum, mode = "rgb") {
|
|
1356
|
+
if (lum !== void 0 && type_default(lum) === "number") {
|
|
1357
|
+
if (lum === 0) {
|
|
1358
|
+
return new Color_default([0, 0, 0, this._rgb[3]], "rgb");
|
|
1359
|
+
}
|
|
1360
|
+
if (lum === 1) {
|
|
1361
|
+
return new Color_default([255, 255, 255, this._rgb[3]], "rgb");
|
|
1362
|
+
}
|
|
1363
|
+
let cur_lum = this.luminance();
|
|
1364
|
+
let max_iter = MAX_ITER;
|
|
1365
|
+
const test = (low, high) => {
|
|
1366
|
+
const mid = low.interpolate(high, 0.5, mode);
|
|
1367
|
+
const lm = mid.luminance();
|
|
1368
|
+
if (Math.abs(lum - lm) < EPS || !max_iter--) {
|
|
1369
|
+
return mid;
|
|
1370
|
+
}
|
|
1371
|
+
return lm > lum ? test(low, mid) : test(mid, high);
|
|
1372
|
+
};
|
|
1373
|
+
const rgb2 = (cur_lum > lum ? test(new Color_default([0, 0, 0]), this) : test(this, new Color_default([255, 255, 255]))).rgb();
|
|
1374
|
+
return new Color_default([...rgb2, this._rgb[3]]);
|
|
1375
|
+
}
|
|
1376
|
+
return rgb2luminance(...this._rgb.slice(0, 3));
|
|
1377
|
+
};
|
|
1378
|
+
var rgb2luminance = (r, g, b) => {
|
|
1379
|
+
r = luminance_x(r);
|
|
1380
|
+
g = luminance_x(g);
|
|
1381
|
+
b = luminance_x(b);
|
|
1382
|
+
return 0.2126 * r + 0.7152 * g + 0.0722 * b;
|
|
1383
|
+
};
|
|
1384
|
+
var luminance_x = (x) => {
|
|
1385
|
+
x /= 255;
|
|
1386
|
+
return x <= 0.03928 ? x / 12.92 : pow5((x + 0.055) / 1.055, 2.4);
|
|
1387
|
+
};
|
|
1388
|
+
|
|
1389
|
+
// ../../node_modules/chroma-js/src/interpolator/index.js
|
|
1390
|
+
var interpolator_default = {};
|
|
1391
|
+
|
|
1392
|
+
// ../../node_modules/chroma-js/src/generator/mix.js
|
|
1393
|
+
var mix_default = (col1, col2, f = 0.5, ...rest) => {
|
|
1394
|
+
let mode = rest[0] || "lrgb";
|
|
1395
|
+
if (!interpolator_default[mode] && !rest.length) {
|
|
1396
|
+
mode = Object.keys(interpolator_default)[0];
|
|
1397
|
+
}
|
|
1398
|
+
if (!interpolator_default[mode]) {
|
|
1399
|
+
throw new Error(`interpolation mode ${mode} is not defined`);
|
|
1400
|
+
}
|
|
1401
|
+
if (type_default(col1) !== "object") col1 = new Color_default(col1);
|
|
1402
|
+
if (type_default(col2) !== "object") col2 = new Color_default(col2);
|
|
1403
|
+
return interpolator_default[mode](col1, col2, f).alpha(
|
|
1404
|
+
col1.alpha() + f * (col2.alpha() - col1.alpha())
|
|
1405
|
+
);
|
|
1406
|
+
};
|
|
1407
|
+
|
|
1408
|
+
// ../../node_modules/chroma-js/src/ops/mix.js
|
|
1409
|
+
Color_default.prototype.mix = Color_default.prototype.interpolate = function(col2, f = 0.5, ...rest) {
|
|
1410
|
+
return mix_default(this, col2, f, ...rest);
|
|
1411
|
+
};
|
|
1412
|
+
|
|
1413
|
+
// ../../node_modules/chroma-js/src/ops/premultiply.js
|
|
1414
|
+
Color_default.prototype.premultiply = function(mutate = false) {
|
|
1415
|
+
const rgb2 = this._rgb;
|
|
1416
|
+
const a = rgb2[3];
|
|
1417
|
+
if (mutate) {
|
|
1418
|
+
this._rgb = [rgb2[0] * a, rgb2[1] * a, rgb2[2] * a, a];
|
|
1419
|
+
return this;
|
|
1420
|
+
} else {
|
|
1421
|
+
return new Color_default([rgb2[0] * a, rgb2[1] * a, rgb2[2] * a, a], "rgb");
|
|
1422
|
+
}
|
|
1423
|
+
};
|
|
1424
|
+
|
|
1425
|
+
// ../../node_modules/chroma-js/src/ops/saturate.js
|
|
1426
|
+
Color_default.prototype.saturate = function(amount = 1) {
|
|
1427
|
+
const me = this;
|
|
1428
|
+
const lch2 = me.lch();
|
|
1429
|
+
lch2[1] += lab_constants_default.Kn * amount;
|
|
1430
|
+
if (lch2[1] < 0) lch2[1] = 0;
|
|
1431
|
+
return new Color_default(lch2, "lch").alpha(me.alpha(), true);
|
|
1432
|
+
};
|
|
1433
|
+
Color_default.prototype.desaturate = function(amount = 1) {
|
|
1434
|
+
return this.saturate(-amount);
|
|
1435
|
+
};
|
|
1436
|
+
|
|
1437
|
+
// ../../node_modules/chroma-js/src/ops/set.js
|
|
1438
|
+
Color_default.prototype.set = function(mc, value, mutate = false) {
|
|
1439
|
+
const [mode, channel] = mc.split(".");
|
|
1440
|
+
const src = this[mode]();
|
|
1441
|
+
if (channel) {
|
|
1442
|
+
const i = mode.indexOf(channel) - (mode.substr(0, 2) === "ok" ? 2 : 0);
|
|
1443
|
+
if (i > -1) {
|
|
1444
|
+
if (type_default(value) == "string") {
|
|
1445
|
+
switch (value.charAt(0)) {
|
|
1446
|
+
case "+":
|
|
1447
|
+
src[i] += +value;
|
|
1448
|
+
break;
|
|
1449
|
+
case "-":
|
|
1450
|
+
src[i] += +value;
|
|
1451
|
+
break;
|
|
1452
|
+
case "*":
|
|
1453
|
+
src[i] *= +value.substr(1);
|
|
1454
|
+
break;
|
|
1455
|
+
case "/":
|
|
1456
|
+
src[i] /= +value.substr(1);
|
|
1457
|
+
break;
|
|
1458
|
+
default:
|
|
1459
|
+
src[i] = +value;
|
|
1460
|
+
}
|
|
1461
|
+
} else if (type_default(value) === "number") {
|
|
1462
|
+
src[i] = value;
|
|
1463
|
+
} else {
|
|
1464
|
+
throw new Error(`unsupported value for Color.set`);
|
|
1465
|
+
}
|
|
1466
|
+
const out = new Color_default(src, mode);
|
|
1467
|
+
if (mutate) {
|
|
1468
|
+
this._rgb = out._rgb;
|
|
1469
|
+
return this;
|
|
1470
|
+
}
|
|
1471
|
+
return out;
|
|
1472
|
+
}
|
|
1473
|
+
throw new Error(`unknown channel ${channel} in mode ${mode}`);
|
|
1474
|
+
} else {
|
|
1475
|
+
return src;
|
|
1476
|
+
}
|
|
1477
|
+
};
|
|
1478
|
+
|
|
1479
|
+
// ../../node_modules/chroma-js/src/ops/shade.js
|
|
1480
|
+
Color_default.prototype.tint = function(f = 0.5, ...rest) {
|
|
1481
|
+
return mix_default(this, "white", f, ...rest);
|
|
1482
|
+
};
|
|
1483
|
+
Color_default.prototype.shade = function(f = 0.5, ...rest) {
|
|
1484
|
+
return mix_default(this, "black", f, ...rest);
|
|
1485
|
+
};
|
|
1486
|
+
|
|
1487
|
+
// ../../node_modules/chroma-js/src/interpolator/rgb.js
|
|
1488
|
+
var rgb = (col1, col2, f) => {
|
|
1489
|
+
const xyz0 = col1._rgb;
|
|
1490
|
+
const xyz1 = col2._rgb;
|
|
1491
|
+
return new Color_default(
|
|
1492
|
+
xyz0[0] + f * (xyz1[0] - xyz0[0]),
|
|
1493
|
+
xyz0[1] + f * (xyz1[1] - xyz0[1]),
|
|
1494
|
+
xyz0[2] + f * (xyz1[2] - xyz0[2]),
|
|
1495
|
+
"rgb"
|
|
1496
|
+
);
|
|
1497
|
+
};
|
|
1498
|
+
interpolator_default.rgb = rgb;
|
|
1499
|
+
|
|
1500
|
+
// ../../node_modules/chroma-js/src/interpolator/lrgb.js
|
|
1501
|
+
var { sqrt: sqrt3, pow: pow6 } = Math;
|
|
1502
|
+
var lrgb = (col1, col2, f) => {
|
|
1503
|
+
const [x1, y1, z1] = col1._rgb;
|
|
1504
|
+
const [x2, y2, z2] = col2._rgb;
|
|
1505
|
+
return new Color_default(
|
|
1506
|
+
sqrt3(pow6(x1, 2) * (1 - f) + pow6(x2, 2) * f),
|
|
1507
|
+
sqrt3(pow6(y1, 2) * (1 - f) + pow6(y2, 2) * f),
|
|
1508
|
+
sqrt3(pow6(z1, 2) * (1 - f) + pow6(z2, 2) * f),
|
|
1509
|
+
"rgb"
|
|
1510
|
+
);
|
|
1511
|
+
};
|
|
1512
|
+
interpolator_default.lrgb = lrgb;
|
|
1513
|
+
|
|
1514
|
+
// ../../node_modules/chroma-js/src/interpolator/lab.js
|
|
1515
|
+
var lab = (col1, col2, f) => {
|
|
1516
|
+
const xyz0 = col1.lab();
|
|
1517
|
+
const xyz1 = col2.lab();
|
|
1518
|
+
return new Color_default(
|
|
1519
|
+
xyz0[0] + f * (xyz1[0] - xyz0[0]),
|
|
1520
|
+
xyz0[1] + f * (xyz1[1] - xyz0[1]),
|
|
1521
|
+
xyz0[2] + f * (xyz1[2] - xyz0[2]),
|
|
1522
|
+
"lab"
|
|
1523
|
+
);
|
|
1524
|
+
};
|
|
1525
|
+
interpolator_default.lab = lab;
|
|
1526
|
+
|
|
1527
|
+
// ../../node_modules/chroma-js/src/interpolator/_hsx.js
|
|
1528
|
+
var hsx_default = (col1, col2, f, m) => {
|
|
1529
|
+
let xyz0, xyz1;
|
|
1530
|
+
if (m === "hsl") {
|
|
1531
|
+
xyz0 = col1.hsl();
|
|
1532
|
+
xyz1 = col2.hsl();
|
|
1533
|
+
} else if (m === "hsv") {
|
|
1534
|
+
xyz0 = col1.hsv();
|
|
1535
|
+
xyz1 = col2.hsv();
|
|
1536
|
+
} else if (m === "hcg") {
|
|
1537
|
+
xyz0 = col1.hcg();
|
|
1538
|
+
xyz1 = col2.hcg();
|
|
1539
|
+
} else if (m === "hsi") {
|
|
1540
|
+
xyz0 = col1.hsi();
|
|
1541
|
+
xyz1 = col2.hsi();
|
|
1542
|
+
} else if (m === "lch" || m === "hcl") {
|
|
1543
|
+
m = "hcl";
|
|
1544
|
+
xyz0 = col1.hcl();
|
|
1545
|
+
xyz1 = col2.hcl();
|
|
1546
|
+
} else if (m === "oklch") {
|
|
1547
|
+
xyz0 = col1.oklch().reverse();
|
|
1548
|
+
xyz1 = col2.oklch().reverse();
|
|
1549
|
+
}
|
|
1550
|
+
let hue0, hue1, sat0, sat1, lbv0, lbv1;
|
|
1551
|
+
if (m.substr(0, 1) === "h" || m === "oklch") {
|
|
1552
|
+
[hue0, sat0, lbv0] = xyz0;
|
|
1553
|
+
[hue1, sat1, lbv1] = xyz1;
|
|
1554
|
+
}
|
|
1555
|
+
let sat, hue, lbv, dh;
|
|
1556
|
+
if (!isNaN(hue0) && !isNaN(hue1)) {
|
|
1557
|
+
if (hue1 > hue0 && hue1 - hue0 > 180) {
|
|
1558
|
+
dh = hue1 - (hue0 + 360);
|
|
1559
|
+
} else if (hue1 < hue0 && hue0 - hue1 > 180) {
|
|
1560
|
+
dh = hue1 + 360 - hue0;
|
|
1561
|
+
} else {
|
|
1562
|
+
dh = hue1 - hue0;
|
|
1563
|
+
}
|
|
1564
|
+
hue = hue0 + f * dh;
|
|
1565
|
+
} else if (!isNaN(hue0)) {
|
|
1566
|
+
hue = hue0;
|
|
1567
|
+
if ((lbv1 == 1 || lbv1 == 0) && m != "hsv") sat = sat0;
|
|
1568
|
+
} else if (!isNaN(hue1)) {
|
|
1569
|
+
hue = hue1;
|
|
1570
|
+
if ((lbv0 == 1 || lbv0 == 0) && m != "hsv") sat = sat1;
|
|
1571
|
+
} else {
|
|
1572
|
+
hue = Number.NaN;
|
|
1573
|
+
}
|
|
1574
|
+
if (sat === void 0) sat = sat0 + f * (sat1 - sat0);
|
|
1575
|
+
lbv = lbv0 + f * (lbv1 - lbv0);
|
|
1576
|
+
return m === "oklch" ? new Color_default([lbv, sat, hue], m) : new Color_default([hue, sat, lbv], m);
|
|
1577
|
+
};
|
|
1578
|
+
|
|
1579
|
+
// ../../node_modules/chroma-js/src/interpolator/lch.js
|
|
1580
|
+
var lch = (col1, col2, f) => {
|
|
1581
|
+
return hsx_default(col1, col2, f, "lch");
|
|
1582
|
+
};
|
|
1583
|
+
interpolator_default.lch = lch;
|
|
1584
|
+
interpolator_default.hcl = lch;
|
|
1585
|
+
|
|
1586
|
+
// ../../node_modules/chroma-js/src/interpolator/num.js
|
|
1587
|
+
var num = (col1, col2, f) => {
|
|
1588
|
+
const c1 = col1.num();
|
|
1589
|
+
const c2 = col2.num();
|
|
1590
|
+
return new Color_default(c1 + f * (c2 - c1), "num");
|
|
1591
|
+
};
|
|
1592
|
+
interpolator_default.num = num;
|
|
1593
|
+
|
|
1594
|
+
// ../../node_modules/chroma-js/src/interpolator/hcg.js
|
|
1595
|
+
var hcg = (col1, col2, f) => {
|
|
1596
|
+
return hsx_default(col1, col2, f, "hcg");
|
|
1597
|
+
};
|
|
1598
|
+
interpolator_default.hcg = hcg;
|
|
1599
|
+
|
|
1600
|
+
// ../../node_modules/chroma-js/src/interpolator/hsi.js
|
|
1601
|
+
var hsi = (col1, col2, f) => {
|
|
1602
|
+
return hsx_default(col1, col2, f, "hsi");
|
|
1603
|
+
};
|
|
1604
|
+
interpolator_default.hsi = hsi;
|
|
1605
|
+
|
|
1606
|
+
// ../../node_modules/chroma-js/src/interpolator/hsl.js
|
|
1607
|
+
var hsl = (col1, col2, f) => {
|
|
1608
|
+
return hsx_default(col1, col2, f, "hsl");
|
|
1609
|
+
};
|
|
1610
|
+
interpolator_default.hsl = hsl;
|
|
1611
|
+
|
|
1612
|
+
// ../../node_modules/chroma-js/src/interpolator/hsv.js
|
|
1613
|
+
var hsv = (col1, col2, f) => {
|
|
1614
|
+
return hsx_default(col1, col2, f, "hsv");
|
|
1615
|
+
};
|
|
1616
|
+
interpolator_default.hsv = hsv;
|
|
1617
|
+
|
|
1618
|
+
// ../../node_modules/chroma-js/src/interpolator/oklab.js
|
|
1619
|
+
var oklab = (col1, col2, f) => {
|
|
1620
|
+
const xyz0 = col1.oklab();
|
|
1621
|
+
const xyz1 = col2.oklab();
|
|
1622
|
+
return new Color_default(
|
|
1623
|
+
xyz0[0] + f * (xyz1[0] - xyz0[0]),
|
|
1624
|
+
xyz0[1] + f * (xyz1[1] - xyz0[1]),
|
|
1625
|
+
xyz0[2] + f * (xyz1[2] - xyz0[2]),
|
|
1626
|
+
"oklab"
|
|
1627
|
+
);
|
|
1628
|
+
};
|
|
1629
|
+
interpolator_default.oklab = oklab;
|
|
1630
|
+
|
|
1631
|
+
// ../../node_modules/chroma-js/src/interpolator/oklch.js
|
|
1632
|
+
var oklch = (col1, col2, f) => {
|
|
1633
|
+
return hsx_default(col1, col2, f, "oklch");
|
|
1634
|
+
};
|
|
1635
|
+
interpolator_default.oklch = oklch;
|
|
1636
|
+
|
|
1637
|
+
// ../../node_modules/chroma-js/src/generator/average.js
|
|
1638
|
+
var { pow: pow7, sqrt: sqrt4, PI: PI2, cos: cos3, sin: sin2, atan2: atan22 } = Math;
|
|
1639
|
+
var average_default = (colors, mode = "lrgb", weights = null) => {
|
|
1640
|
+
const l = colors.length;
|
|
1641
|
+
if (!weights) weights = Array.from(new Array(l)).map(() => 1);
|
|
1642
|
+
const k = l / weights.reduce(function(a, b) {
|
|
1643
|
+
return a + b;
|
|
1644
|
+
});
|
|
1645
|
+
weights.forEach((w, i) => {
|
|
1646
|
+
weights[i] *= k;
|
|
1647
|
+
});
|
|
1648
|
+
colors = colors.map((c) => new Color_default(c));
|
|
1649
|
+
if (mode === "lrgb") {
|
|
1650
|
+
return _average_lrgb(colors, weights);
|
|
1651
|
+
}
|
|
1652
|
+
const first = colors.shift();
|
|
1653
|
+
const xyz = first.get(mode);
|
|
1654
|
+
const cnt = [];
|
|
1655
|
+
let dx = 0;
|
|
1656
|
+
let dy = 0;
|
|
1657
|
+
for (let i = 0; i < xyz.length; i++) {
|
|
1658
|
+
xyz[i] = (xyz[i] || 0) * weights[0];
|
|
1659
|
+
cnt.push(isNaN(xyz[i]) ? 0 : weights[0]);
|
|
1660
|
+
if (mode.charAt(i) === "h" && !isNaN(xyz[i])) {
|
|
1661
|
+
const A = xyz[i] / 180 * PI2;
|
|
1662
|
+
dx += cos3(A) * weights[0];
|
|
1663
|
+
dy += sin2(A) * weights[0];
|
|
1664
|
+
}
|
|
1665
|
+
}
|
|
1666
|
+
let alpha = first.alpha() * weights[0];
|
|
1667
|
+
colors.forEach((c, ci) => {
|
|
1668
|
+
const xyz2 = c.get(mode);
|
|
1669
|
+
alpha += c.alpha() * weights[ci + 1];
|
|
1670
|
+
for (let i = 0; i < xyz.length; i++) {
|
|
1671
|
+
if (!isNaN(xyz2[i])) {
|
|
1672
|
+
cnt[i] += weights[ci + 1];
|
|
1673
|
+
if (mode.charAt(i) === "h") {
|
|
1674
|
+
const A = xyz2[i] / 180 * PI2;
|
|
1675
|
+
dx += cos3(A) * weights[ci + 1];
|
|
1676
|
+
dy += sin2(A) * weights[ci + 1];
|
|
1677
|
+
} else {
|
|
1678
|
+
xyz[i] += xyz2[i] * weights[ci + 1];
|
|
1679
|
+
}
|
|
1680
|
+
}
|
|
1681
|
+
}
|
|
1682
|
+
});
|
|
1683
|
+
for (let i = 0; i < xyz.length; i++) {
|
|
1684
|
+
if (mode.charAt(i) === "h") {
|
|
1685
|
+
let A = atan22(dy / cnt[i], dx / cnt[i]) / PI2 * 180;
|
|
1686
|
+
while (A < 0) A += 360;
|
|
1687
|
+
while (A >= 360) A -= 360;
|
|
1688
|
+
xyz[i] = A;
|
|
1689
|
+
} else {
|
|
1690
|
+
xyz[i] = xyz[i] / cnt[i];
|
|
1691
|
+
}
|
|
1692
|
+
}
|
|
1693
|
+
alpha /= l;
|
|
1694
|
+
return new Color_default(xyz, mode).alpha(alpha > 0.99999 ? 1 : alpha, true);
|
|
1695
|
+
};
|
|
1696
|
+
var _average_lrgb = (colors, weights) => {
|
|
1697
|
+
const l = colors.length;
|
|
1698
|
+
const xyz = [0, 0, 0, 0];
|
|
1699
|
+
for (let i = 0; i < colors.length; i++) {
|
|
1700
|
+
const col = colors[i];
|
|
1701
|
+
const f = weights[i] / l;
|
|
1702
|
+
const rgb2 = col._rgb;
|
|
1703
|
+
xyz[0] += pow7(rgb2[0], 2) * f;
|
|
1704
|
+
xyz[1] += pow7(rgb2[1], 2) * f;
|
|
1705
|
+
xyz[2] += pow7(rgb2[2], 2) * f;
|
|
1706
|
+
xyz[3] += rgb2[3] * f;
|
|
1707
|
+
}
|
|
1708
|
+
xyz[0] = sqrt4(xyz[0]);
|
|
1709
|
+
xyz[1] = sqrt4(xyz[1]);
|
|
1710
|
+
xyz[2] = sqrt4(xyz[2]);
|
|
1711
|
+
if (xyz[3] > 0.9999999) xyz[3] = 1;
|
|
1712
|
+
return new Color_default(clip_rgb_default(xyz));
|
|
1713
|
+
};
|
|
1714
|
+
|
|
1715
|
+
// ../../node_modules/chroma-js/src/generator/scale.js
|
|
1716
|
+
var { pow: pow8 } = Math;
|
|
1717
|
+
function scale_default(colors) {
|
|
1718
|
+
let _mode = "rgb";
|
|
1719
|
+
let _nacol = chroma_default("#ccc");
|
|
1720
|
+
let _spread = 0;
|
|
1721
|
+
let _domain = [0, 1];
|
|
1722
|
+
let _pos = [];
|
|
1723
|
+
let _padding = [0, 0];
|
|
1724
|
+
let _classes = false;
|
|
1725
|
+
let _colors = [];
|
|
1726
|
+
let _out = false;
|
|
1727
|
+
let _min = 0;
|
|
1728
|
+
let _max = 1;
|
|
1729
|
+
let _correctLightness = false;
|
|
1730
|
+
let _colorCache = {};
|
|
1731
|
+
let _useCache = true;
|
|
1732
|
+
let _gamma = 1;
|
|
1733
|
+
const setColors = function(colors2) {
|
|
1734
|
+
colors2 = colors2 || ["#fff", "#000"];
|
|
1735
|
+
if (colors2 && type_default(colors2) === "string" && chroma_default.brewer && chroma_default.brewer[colors2.toLowerCase()]) {
|
|
1736
|
+
colors2 = chroma_default.brewer[colors2.toLowerCase()];
|
|
1737
|
+
}
|
|
1738
|
+
if (type_default(colors2) === "array") {
|
|
1739
|
+
if (colors2.length === 1) {
|
|
1740
|
+
colors2 = [colors2[0], colors2[0]];
|
|
1741
|
+
}
|
|
1742
|
+
colors2 = colors2.slice(0);
|
|
1743
|
+
for (let c = 0; c < colors2.length; c++) {
|
|
1744
|
+
colors2[c] = chroma_default(colors2[c]);
|
|
1745
|
+
}
|
|
1746
|
+
_pos.length = 0;
|
|
1747
|
+
for (let c = 0; c < colors2.length; c++) {
|
|
1748
|
+
_pos.push(c / (colors2.length - 1));
|
|
1749
|
+
}
|
|
1750
|
+
}
|
|
1751
|
+
resetCache();
|
|
1752
|
+
return _colors = colors2;
|
|
1753
|
+
};
|
|
1754
|
+
const getClass = function(value) {
|
|
1755
|
+
if (_classes != null) {
|
|
1756
|
+
const n = _classes.length - 1;
|
|
1757
|
+
let i = 0;
|
|
1758
|
+
while (i < n && value >= _classes[i]) {
|
|
1759
|
+
i++;
|
|
1760
|
+
}
|
|
1761
|
+
return i - 1;
|
|
1762
|
+
}
|
|
1763
|
+
return 0;
|
|
1764
|
+
};
|
|
1765
|
+
let tMapLightness = (t) => t;
|
|
1766
|
+
let tMapDomain = (t) => t;
|
|
1767
|
+
const getColor = function(val, bypassMap) {
|
|
1768
|
+
let col, t;
|
|
1769
|
+
if (bypassMap == null) {
|
|
1770
|
+
bypassMap = false;
|
|
1771
|
+
}
|
|
1772
|
+
if (isNaN(val) || val === null) {
|
|
1773
|
+
return _nacol;
|
|
1774
|
+
}
|
|
1775
|
+
if (!bypassMap) {
|
|
1776
|
+
if (_classes && _classes.length > 2) {
|
|
1777
|
+
const c = getClass(val);
|
|
1778
|
+
t = c / (_classes.length - 2);
|
|
1779
|
+
} else if (_max !== _min) {
|
|
1780
|
+
t = (val - _min) / (_max - _min);
|
|
1781
|
+
} else {
|
|
1782
|
+
t = 1;
|
|
1783
|
+
}
|
|
1784
|
+
} else {
|
|
1785
|
+
t = val;
|
|
1786
|
+
}
|
|
1787
|
+
t = tMapDomain(t);
|
|
1788
|
+
if (!bypassMap) {
|
|
1789
|
+
t = tMapLightness(t);
|
|
1790
|
+
}
|
|
1791
|
+
if (_gamma !== 1) {
|
|
1792
|
+
t = pow8(t, _gamma);
|
|
1793
|
+
}
|
|
1794
|
+
t = _padding[0] + t * (1 - _padding[0] - _padding[1]);
|
|
1795
|
+
t = limit_default(t, 0, 1);
|
|
1796
|
+
const k = Math.floor(t * 1e4);
|
|
1797
|
+
if (_useCache && _colorCache[k]) {
|
|
1798
|
+
col = _colorCache[k];
|
|
1799
|
+
} else {
|
|
1800
|
+
if (type_default(_colors) === "array") {
|
|
1801
|
+
for (let i = 0; i < _pos.length; i++) {
|
|
1802
|
+
const p = _pos[i];
|
|
1803
|
+
if (t <= p) {
|
|
1804
|
+
col = _colors[i];
|
|
1805
|
+
break;
|
|
1806
|
+
}
|
|
1807
|
+
if (t >= p && i === _pos.length - 1) {
|
|
1808
|
+
col = _colors[i];
|
|
1809
|
+
break;
|
|
1810
|
+
}
|
|
1811
|
+
if (t > p && t < _pos[i + 1]) {
|
|
1812
|
+
t = (t - p) / (_pos[i + 1] - p);
|
|
1813
|
+
col = chroma_default.interpolate(
|
|
1814
|
+
_colors[i],
|
|
1815
|
+
_colors[i + 1],
|
|
1816
|
+
t,
|
|
1817
|
+
_mode
|
|
1818
|
+
);
|
|
1819
|
+
break;
|
|
1820
|
+
}
|
|
1821
|
+
}
|
|
1822
|
+
} else if (type_default(_colors) === "function") {
|
|
1823
|
+
col = _colors(t);
|
|
1824
|
+
}
|
|
1825
|
+
if (_useCache) {
|
|
1826
|
+
_colorCache[k] = col;
|
|
1827
|
+
}
|
|
1828
|
+
}
|
|
1829
|
+
return col;
|
|
1830
|
+
};
|
|
1831
|
+
var resetCache = () => _colorCache = {};
|
|
1832
|
+
setColors(colors);
|
|
1833
|
+
const f = function(v) {
|
|
1834
|
+
const c = chroma_default(getColor(v));
|
|
1835
|
+
if (_out && c[_out]) {
|
|
1836
|
+
return c[_out]();
|
|
1837
|
+
} else {
|
|
1838
|
+
return c;
|
|
1839
|
+
}
|
|
1840
|
+
};
|
|
1841
|
+
f.classes = function(classes) {
|
|
1842
|
+
if (classes != null) {
|
|
1843
|
+
if (type_default(classes) === "array") {
|
|
1844
|
+
_classes = classes;
|
|
1845
|
+
_domain = [classes[0], classes[classes.length - 1]];
|
|
1846
|
+
} else {
|
|
1847
|
+
const d = chroma_default.analyze(_domain);
|
|
1848
|
+
if (classes === 0) {
|
|
1849
|
+
_classes = [d.min, d.max];
|
|
1850
|
+
} else {
|
|
1851
|
+
_classes = chroma_default.limits(d, "e", classes);
|
|
1852
|
+
}
|
|
1853
|
+
}
|
|
1854
|
+
return f;
|
|
1855
|
+
}
|
|
1856
|
+
return _classes;
|
|
1857
|
+
};
|
|
1858
|
+
f.domain = function(domain) {
|
|
1859
|
+
if (!arguments.length) {
|
|
1860
|
+
return _domain;
|
|
1861
|
+
}
|
|
1862
|
+
_min = domain[0];
|
|
1863
|
+
_max = domain[domain.length - 1];
|
|
1864
|
+
_pos = [];
|
|
1865
|
+
const k = _colors.length;
|
|
1866
|
+
if (domain.length === k && _min !== _max) {
|
|
1867
|
+
for (let d of Array.from(domain)) {
|
|
1868
|
+
_pos.push((d - _min) / (_max - _min));
|
|
1869
|
+
}
|
|
1870
|
+
} else {
|
|
1871
|
+
for (let c = 0; c < k; c++) {
|
|
1872
|
+
_pos.push(c / (k - 1));
|
|
1873
|
+
}
|
|
1874
|
+
if (domain.length > 2) {
|
|
1875
|
+
const tOut = domain.map((d, i) => i / (domain.length - 1));
|
|
1876
|
+
const tBreaks = domain.map((d) => (d - _min) / (_max - _min));
|
|
1877
|
+
if (!tBreaks.every((val, i) => tOut[i] === val)) {
|
|
1878
|
+
tMapDomain = (t) => {
|
|
1879
|
+
if (t <= 0 || t >= 1) return t;
|
|
1880
|
+
let i = 0;
|
|
1881
|
+
while (t >= tBreaks[i + 1]) i++;
|
|
1882
|
+
const f2 = (t - tBreaks[i]) / (tBreaks[i + 1] - tBreaks[i]);
|
|
1883
|
+
const out = tOut[i] + f2 * (tOut[i + 1] - tOut[i]);
|
|
1884
|
+
return out;
|
|
1885
|
+
};
|
|
1886
|
+
}
|
|
1887
|
+
}
|
|
1888
|
+
}
|
|
1889
|
+
_domain = [_min, _max];
|
|
1890
|
+
return f;
|
|
1891
|
+
};
|
|
1892
|
+
f.mode = function(_m) {
|
|
1893
|
+
if (!arguments.length) {
|
|
1894
|
+
return _mode;
|
|
1895
|
+
}
|
|
1896
|
+
_mode = _m;
|
|
1897
|
+
resetCache();
|
|
1898
|
+
return f;
|
|
1899
|
+
};
|
|
1900
|
+
f.range = function(colors2, _pos2) {
|
|
1901
|
+
setColors(colors2, _pos2);
|
|
1902
|
+
return f;
|
|
1903
|
+
};
|
|
1904
|
+
f.out = function(_o) {
|
|
1905
|
+
_out = _o;
|
|
1906
|
+
return f;
|
|
1907
|
+
};
|
|
1908
|
+
f.spread = function(val) {
|
|
1909
|
+
if (!arguments.length) {
|
|
1910
|
+
return _spread;
|
|
1911
|
+
}
|
|
1912
|
+
_spread = val;
|
|
1913
|
+
return f;
|
|
1914
|
+
};
|
|
1915
|
+
f.correctLightness = function(v) {
|
|
1916
|
+
if (v == null) {
|
|
1917
|
+
v = true;
|
|
1918
|
+
}
|
|
1919
|
+
_correctLightness = v;
|
|
1920
|
+
resetCache();
|
|
1921
|
+
if (_correctLightness) {
|
|
1922
|
+
tMapLightness = function(t) {
|
|
1923
|
+
const L0 = getColor(0, true).lab()[0];
|
|
1924
|
+
const L1 = getColor(1, true).lab()[0];
|
|
1925
|
+
const pol = L0 > L1;
|
|
1926
|
+
let L_actual = getColor(t, true).lab()[0];
|
|
1927
|
+
const L_ideal = L0 + (L1 - L0) * t;
|
|
1928
|
+
let L_diff = L_actual - L_ideal;
|
|
1929
|
+
let t0 = 0;
|
|
1930
|
+
let t1 = 1;
|
|
1931
|
+
let max_iter = 20;
|
|
1932
|
+
while (Math.abs(L_diff) > 0.01 && max_iter-- > 0) {
|
|
1933
|
+
(function() {
|
|
1934
|
+
if (pol) {
|
|
1935
|
+
L_diff *= -1;
|
|
1936
|
+
}
|
|
1937
|
+
if (L_diff < 0) {
|
|
1938
|
+
t0 = t;
|
|
1939
|
+
t += (t1 - t) * 0.5;
|
|
1940
|
+
} else {
|
|
1941
|
+
t1 = t;
|
|
1942
|
+
t += (t0 - t) * 0.5;
|
|
1943
|
+
}
|
|
1944
|
+
L_actual = getColor(t, true).lab()[0];
|
|
1945
|
+
return L_diff = L_actual - L_ideal;
|
|
1946
|
+
})();
|
|
1947
|
+
}
|
|
1948
|
+
return t;
|
|
1949
|
+
};
|
|
1950
|
+
} else {
|
|
1951
|
+
tMapLightness = (t) => t;
|
|
1952
|
+
}
|
|
1953
|
+
return f;
|
|
1954
|
+
};
|
|
1955
|
+
f.padding = function(p) {
|
|
1956
|
+
if (p != null) {
|
|
1957
|
+
if (type_default(p) === "number") {
|
|
1958
|
+
p = [p, p];
|
|
1959
|
+
}
|
|
1960
|
+
_padding = p;
|
|
1961
|
+
return f;
|
|
1962
|
+
} else {
|
|
1963
|
+
return _padding;
|
|
1964
|
+
}
|
|
1965
|
+
};
|
|
1966
|
+
f.colors = function(numColors, out) {
|
|
1967
|
+
if (arguments.length < 2) {
|
|
1968
|
+
out = "hex";
|
|
1969
|
+
}
|
|
1970
|
+
let result = [];
|
|
1971
|
+
if (arguments.length === 0) {
|
|
1972
|
+
result = _colors.slice(0);
|
|
1973
|
+
} else if (numColors === 1) {
|
|
1974
|
+
result = [f(0.5)];
|
|
1975
|
+
} else if (numColors > 1) {
|
|
1976
|
+
const dm = _domain[0];
|
|
1977
|
+
const dd = _domain[1] - dm;
|
|
1978
|
+
result = __range__(0, numColors, false).map(
|
|
1979
|
+
(i) => f(dm + i / (numColors - 1) * dd)
|
|
1980
|
+
);
|
|
1981
|
+
} else {
|
|
1982
|
+
colors = [];
|
|
1983
|
+
let samples = [];
|
|
1984
|
+
if (_classes && _classes.length > 2) {
|
|
1985
|
+
for (let i = 1, end = _classes.length, asc = 1 <= end; asc ? i < end : i > end; asc ? i++ : i--) {
|
|
1986
|
+
samples.push((_classes[i - 1] + _classes[i]) * 0.5);
|
|
1987
|
+
}
|
|
1988
|
+
} else {
|
|
1989
|
+
samples = _domain;
|
|
1990
|
+
}
|
|
1991
|
+
result = samples.map((v) => f(v));
|
|
1992
|
+
}
|
|
1993
|
+
if (chroma_default[out]) {
|
|
1994
|
+
result = result.map((c) => c[out]());
|
|
1995
|
+
}
|
|
1996
|
+
return result;
|
|
1997
|
+
};
|
|
1998
|
+
f.cache = function(c) {
|
|
1999
|
+
if (c != null) {
|
|
2000
|
+
_useCache = c;
|
|
2001
|
+
return f;
|
|
2002
|
+
} else {
|
|
2003
|
+
return _useCache;
|
|
2004
|
+
}
|
|
2005
|
+
};
|
|
2006
|
+
f.gamma = function(g) {
|
|
2007
|
+
if (g != null) {
|
|
2008
|
+
_gamma = g;
|
|
2009
|
+
return f;
|
|
2010
|
+
} else {
|
|
2011
|
+
return _gamma;
|
|
2012
|
+
}
|
|
2013
|
+
};
|
|
2014
|
+
f.nodata = function(d) {
|
|
2015
|
+
if (d != null) {
|
|
2016
|
+
_nacol = chroma_default(d);
|
|
2017
|
+
return f;
|
|
2018
|
+
} else {
|
|
2019
|
+
return _nacol;
|
|
2020
|
+
}
|
|
2021
|
+
};
|
|
2022
|
+
return f;
|
|
2023
|
+
}
|
|
2024
|
+
function __range__(left, right, inclusive) {
|
|
2025
|
+
let range = [];
|
|
2026
|
+
let ascending = left < right;
|
|
2027
|
+
let end = !inclusive ? right : ascending ? right + 1 : right - 1;
|
|
2028
|
+
for (let i = left; ascending ? i < end : i > end; ascending ? i++ : i--) {
|
|
2029
|
+
range.push(i);
|
|
2030
|
+
}
|
|
2031
|
+
return range;
|
|
2032
|
+
}
|
|
2033
|
+
|
|
2034
|
+
// ../../node_modules/chroma-js/src/generator/bezier.js
|
|
2035
|
+
var binom_row = function(n) {
|
|
2036
|
+
let row = [1, 1];
|
|
2037
|
+
for (let i = 1; i < n; i++) {
|
|
2038
|
+
let newrow = [1];
|
|
2039
|
+
for (let j = 1; j <= row.length; j++) {
|
|
2040
|
+
newrow[j] = (row[j] || 0) + row[j - 1];
|
|
2041
|
+
}
|
|
2042
|
+
row = newrow;
|
|
2043
|
+
}
|
|
2044
|
+
return row;
|
|
2045
|
+
};
|
|
2046
|
+
var bezier = function(colors) {
|
|
2047
|
+
let I, lab0, lab1, lab2;
|
|
2048
|
+
colors = colors.map((c) => new Color_default(c));
|
|
2049
|
+
if (colors.length === 2) {
|
|
2050
|
+
[lab0, lab1] = colors.map((c) => c.lab());
|
|
2051
|
+
I = function(t) {
|
|
2052
|
+
const lab3 = [0, 1, 2].map((i) => lab0[i] + t * (lab1[i] - lab0[i]));
|
|
2053
|
+
return new Color_default(lab3, "lab");
|
|
2054
|
+
};
|
|
2055
|
+
} else if (colors.length === 3) {
|
|
2056
|
+
[lab0, lab1, lab2] = colors.map((c) => c.lab());
|
|
2057
|
+
I = function(t) {
|
|
2058
|
+
const lab3 = [0, 1, 2].map(
|
|
2059
|
+
(i) => (1 - t) * (1 - t) * lab0[i] + 2 * (1 - t) * t * lab1[i] + t * t * lab2[i]
|
|
2060
|
+
);
|
|
2061
|
+
return new Color_default(lab3, "lab");
|
|
2062
|
+
};
|
|
2063
|
+
} else if (colors.length === 4) {
|
|
2064
|
+
let lab3;
|
|
2065
|
+
[lab0, lab1, lab2, lab3] = colors.map((c) => c.lab());
|
|
2066
|
+
I = function(t) {
|
|
2067
|
+
const lab4 = [0, 1, 2].map(
|
|
2068
|
+
(i) => (1 - t) * (1 - t) * (1 - t) * lab0[i] + 3 * (1 - t) * (1 - t) * t * lab1[i] + 3 * (1 - t) * t * t * lab2[i] + t * t * t * lab3[i]
|
|
2069
|
+
);
|
|
2070
|
+
return new Color_default(lab4, "lab");
|
|
2071
|
+
};
|
|
2072
|
+
} else if (colors.length >= 5) {
|
|
2073
|
+
let labs, row, n;
|
|
2074
|
+
labs = colors.map((c) => c.lab());
|
|
2075
|
+
n = colors.length - 1;
|
|
2076
|
+
row = binom_row(n);
|
|
2077
|
+
I = function(t) {
|
|
2078
|
+
const u = 1 - t;
|
|
2079
|
+
const lab3 = [0, 1, 2].map(
|
|
2080
|
+
(i) => labs.reduce(
|
|
2081
|
+
(sum, el, j) => sum + row[j] * u ** (n - j) * t ** j * el[i],
|
|
2082
|
+
0
|
|
2083
|
+
)
|
|
2084
|
+
);
|
|
2085
|
+
return new Color_default(lab3, "lab");
|
|
2086
|
+
};
|
|
2087
|
+
} else {
|
|
2088
|
+
throw new RangeError("No point in running bezier with only one color.");
|
|
2089
|
+
}
|
|
2090
|
+
return I;
|
|
2091
|
+
};
|
|
2092
|
+
var bezier_default = (colors) => {
|
|
2093
|
+
const f = bezier(colors);
|
|
2094
|
+
f.scale = () => scale_default(f);
|
|
2095
|
+
return f;
|
|
2096
|
+
};
|
|
2097
|
+
|
|
2098
|
+
// ../../node_modules/chroma-js/src/generator/blend.js
|
|
2099
|
+
var blend = (bottom, top, mode) => {
|
|
2100
|
+
if (!blend[mode]) {
|
|
2101
|
+
throw new Error("unknown blend mode " + mode);
|
|
2102
|
+
}
|
|
2103
|
+
return blend[mode](bottom, top);
|
|
2104
|
+
};
|
|
2105
|
+
var blend_f = (f) => (bottom, top) => {
|
|
2106
|
+
const c0 = chroma_default(top).rgb();
|
|
2107
|
+
const c1 = chroma_default(bottom).rgb();
|
|
2108
|
+
return chroma_default.rgb(f(c0, c1));
|
|
2109
|
+
};
|
|
2110
|
+
var each = (f) => (c0, c1) => {
|
|
2111
|
+
const out = [];
|
|
2112
|
+
out[0] = f(c0[0], c1[0]);
|
|
2113
|
+
out[1] = f(c0[1], c1[1]);
|
|
2114
|
+
out[2] = f(c0[2], c1[2]);
|
|
2115
|
+
return out;
|
|
2116
|
+
};
|
|
2117
|
+
var normal = (a) => a;
|
|
2118
|
+
var multiply = (a, b) => a * b / 255;
|
|
2119
|
+
var darken = (a, b) => a > b ? b : a;
|
|
2120
|
+
var lighten = (a, b) => a > b ? a : b;
|
|
2121
|
+
var screen = (a, b) => 255 * (1 - (1 - a / 255) * (1 - b / 255));
|
|
2122
|
+
var overlay = (a, b) => b < 128 ? 2 * a * b / 255 : 255 * (1 - 2 * (1 - a / 255) * (1 - b / 255));
|
|
2123
|
+
var burn = (a, b) => 255 * (1 - (1 - b / 255) / (a / 255));
|
|
2124
|
+
var dodge = (a, b) => {
|
|
2125
|
+
if (a === 255) return 255;
|
|
2126
|
+
a = 255 * (b / 255) / (1 - a / 255);
|
|
2127
|
+
return a > 255 ? 255 : a;
|
|
2128
|
+
};
|
|
2129
|
+
blend.normal = blend_f(each(normal));
|
|
2130
|
+
blend.multiply = blend_f(each(multiply));
|
|
2131
|
+
blend.screen = blend_f(each(screen));
|
|
2132
|
+
blend.overlay = blend_f(each(overlay));
|
|
2133
|
+
blend.darken = blend_f(each(darken));
|
|
2134
|
+
blend.lighten = blend_f(each(lighten));
|
|
2135
|
+
blend.dodge = blend_f(each(dodge));
|
|
2136
|
+
blend.burn = blend_f(each(burn));
|
|
2137
|
+
var blend_default = blend;
|
|
2138
|
+
|
|
2139
|
+
// ../../node_modules/chroma-js/src/generator/cubehelix.js
|
|
2140
|
+
var { pow: pow9, sin: sin3, cos: cos4 } = Math;
|
|
2141
|
+
function cubehelix_default(start = 300, rotations = -1.5, hue = 1, gamma = 1, lightness = [0, 1]) {
|
|
2142
|
+
let dh = 0, dl;
|
|
2143
|
+
if (type_default(lightness) === "array") {
|
|
2144
|
+
dl = lightness[1] - lightness[0];
|
|
2145
|
+
} else {
|
|
2146
|
+
dl = 0;
|
|
2147
|
+
lightness = [lightness, lightness];
|
|
2148
|
+
}
|
|
2149
|
+
const f = function(fract) {
|
|
2150
|
+
const a = TWOPI * ((start + 120) / 360 + rotations * fract);
|
|
2151
|
+
const l = pow9(lightness[0] + dl * fract, gamma);
|
|
2152
|
+
const h = dh !== 0 ? hue[0] + fract * dh : hue;
|
|
2153
|
+
const amp = h * l * (1 - l) / 2;
|
|
2154
|
+
const cos_a = cos4(a);
|
|
2155
|
+
const sin_a = sin3(a);
|
|
2156
|
+
const r = l + amp * (-0.14861 * cos_a + 1.78277 * sin_a);
|
|
2157
|
+
const g = l + amp * (-0.29227 * cos_a - 0.90649 * sin_a);
|
|
2158
|
+
const b = l + amp * (1.97294 * cos_a);
|
|
2159
|
+
return chroma_default(clip_rgb_default([r * 255, g * 255, b * 255, 1]));
|
|
2160
|
+
};
|
|
2161
|
+
f.start = function(s) {
|
|
2162
|
+
if (s == null) {
|
|
2163
|
+
return start;
|
|
2164
|
+
}
|
|
2165
|
+
start = s;
|
|
2166
|
+
return f;
|
|
2167
|
+
};
|
|
2168
|
+
f.rotations = function(r) {
|
|
2169
|
+
if (r == null) {
|
|
2170
|
+
return rotations;
|
|
2171
|
+
}
|
|
2172
|
+
rotations = r;
|
|
2173
|
+
return f;
|
|
2174
|
+
};
|
|
2175
|
+
f.gamma = function(g) {
|
|
2176
|
+
if (g == null) {
|
|
2177
|
+
return gamma;
|
|
2178
|
+
}
|
|
2179
|
+
gamma = g;
|
|
2180
|
+
return f;
|
|
2181
|
+
};
|
|
2182
|
+
f.hue = function(h) {
|
|
2183
|
+
if (h == null) {
|
|
2184
|
+
return hue;
|
|
2185
|
+
}
|
|
2186
|
+
hue = h;
|
|
2187
|
+
if (type_default(hue) === "array") {
|
|
2188
|
+
dh = hue[1] - hue[0];
|
|
2189
|
+
if (dh === 0) {
|
|
2190
|
+
hue = hue[1];
|
|
2191
|
+
}
|
|
2192
|
+
} else {
|
|
2193
|
+
dh = 0;
|
|
2194
|
+
}
|
|
2195
|
+
return f;
|
|
2196
|
+
};
|
|
2197
|
+
f.lightness = function(h) {
|
|
2198
|
+
if (h == null) {
|
|
2199
|
+
return lightness;
|
|
2200
|
+
}
|
|
2201
|
+
if (type_default(h) === "array") {
|
|
2202
|
+
lightness = h;
|
|
2203
|
+
dl = h[1] - h[0];
|
|
2204
|
+
} else {
|
|
2205
|
+
lightness = [h, h];
|
|
2206
|
+
dl = 0;
|
|
2207
|
+
}
|
|
2208
|
+
return f;
|
|
2209
|
+
};
|
|
2210
|
+
f.scale = () => chroma_default.scale(f);
|
|
2211
|
+
f.hue(hue);
|
|
2212
|
+
return f;
|
|
2213
|
+
}
|
|
2214
|
+
|
|
2215
|
+
// ../../node_modules/chroma-js/src/generator/random.js
|
|
2216
|
+
var digits = "0123456789abcdef";
|
|
2217
|
+
var { floor: floor3, random } = Math;
|
|
2218
|
+
var random_default = () => {
|
|
2219
|
+
let code = "#";
|
|
2220
|
+
for (let i = 0; i < 6; i++) {
|
|
2221
|
+
code += digits.charAt(floor3(random() * 16));
|
|
2222
|
+
}
|
|
2223
|
+
return new Color_default(code, "hex");
|
|
2224
|
+
};
|
|
2225
|
+
|
|
2226
|
+
// ../../node_modules/chroma-js/src/utils/analyze.js
|
|
2227
|
+
var { log: log2, pow: pow10, floor: floor4, abs } = Math;
|
|
2228
|
+
function analyze(data, key = null) {
|
|
2229
|
+
const r = {
|
|
2230
|
+
min: Number.MAX_VALUE,
|
|
2231
|
+
max: Number.MAX_VALUE * -1,
|
|
2232
|
+
sum: 0,
|
|
2233
|
+
values: [],
|
|
2234
|
+
count: 0
|
|
2235
|
+
};
|
|
2236
|
+
if (type_default(data) === "object") {
|
|
2237
|
+
data = Object.values(data);
|
|
2238
|
+
}
|
|
2239
|
+
data.forEach((val) => {
|
|
2240
|
+
if (key && type_default(val) === "object") val = val[key];
|
|
2241
|
+
if (val !== void 0 && val !== null && !isNaN(val)) {
|
|
2242
|
+
r.values.push(val);
|
|
2243
|
+
r.sum += val;
|
|
2244
|
+
if (val < r.min) r.min = val;
|
|
2245
|
+
if (val > r.max) r.max = val;
|
|
2246
|
+
r.count += 1;
|
|
2247
|
+
}
|
|
2248
|
+
});
|
|
2249
|
+
r.domain = [r.min, r.max];
|
|
2250
|
+
r.limits = (mode, num2) => limits(r, mode, num2);
|
|
2251
|
+
return r;
|
|
2252
|
+
}
|
|
2253
|
+
function limits(data, mode = "equal", num2 = 7) {
|
|
2254
|
+
if (type_default(data) == "array") {
|
|
2255
|
+
data = analyze(data);
|
|
2256
|
+
}
|
|
2257
|
+
const { min: min5, max: max5 } = data;
|
|
2258
|
+
const values = data.values.sort((a, b) => a - b);
|
|
2259
|
+
if (num2 === 1) {
|
|
2260
|
+
return [min5, max5];
|
|
2261
|
+
}
|
|
2262
|
+
const limits2 = [];
|
|
2263
|
+
if (mode.substr(0, 1) === "c") {
|
|
2264
|
+
limits2.push(min5);
|
|
2265
|
+
limits2.push(max5);
|
|
2266
|
+
}
|
|
2267
|
+
if (mode.substr(0, 1) === "e") {
|
|
2268
|
+
limits2.push(min5);
|
|
2269
|
+
for (let i = 1; i < num2; i++) {
|
|
2270
|
+
limits2.push(min5 + i / num2 * (max5 - min5));
|
|
2271
|
+
}
|
|
2272
|
+
limits2.push(max5);
|
|
2273
|
+
} else if (mode.substr(0, 1) === "l") {
|
|
2274
|
+
if (min5 <= 0) {
|
|
2275
|
+
throw new Error(
|
|
2276
|
+
"Logarithmic scales are only possible for values > 0"
|
|
2277
|
+
);
|
|
2278
|
+
}
|
|
2279
|
+
const min_log = Math.LOG10E * log2(min5);
|
|
2280
|
+
const max_log = Math.LOG10E * log2(max5);
|
|
2281
|
+
limits2.push(min5);
|
|
2282
|
+
for (let i = 1; i < num2; i++) {
|
|
2283
|
+
limits2.push(pow10(10, min_log + i / num2 * (max_log - min_log)));
|
|
2284
|
+
}
|
|
2285
|
+
limits2.push(max5);
|
|
2286
|
+
} else if (mode.substr(0, 1) === "q") {
|
|
2287
|
+
limits2.push(min5);
|
|
2288
|
+
for (let i = 1; i < num2; i++) {
|
|
2289
|
+
const p = (values.length - 1) * i / num2;
|
|
2290
|
+
const pb = floor4(p);
|
|
2291
|
+
if (pb === p) {
|
|
2292
|
+
limits2.push(values[pb]);
|
|
2293
|
+
} else {
|
|
2294
|
+
const pr = p - pb;
|
|
2295
|
+
limits2.push(values[pb] * (1 - pr) + values[pb + 1] * pr);
|
|
2296
|
+
}
|
|
2297
|
+
}
|
|
2298
|
+
limits2.push(max5);
|
|
2299
|
+
} else if (mode.substr(0, 1) === "k") {
|
|
2300
|
+
let cluster;
|
|
2301
|
+
const n = values.length;
|
|
2302
|
+
const assignments = new Array(n);
|
|
2303
|
+
const clusterSizes = new Array(num2);
|
|
2304
|
+
let repeat = true;
|
|
2305
|
+
let nb_iters = 0;
|
|
2306
|
+
let centroids = null;
|
|
2307
|
+
centroids = [];
|
|
2308
|
+
centroids.push(min5);
|
|
2309
|
+
for (let i = 1; i < num2; i++) {
|
|
2310
|
+
centroids.push(min5 + i / num2 * (max5 - min5));
|
|
2311
|
+
}
|
|
2312
|
+
centroids.push(max5);
|
|
2313
|
+
while (repeat) {
|
|
2314
|
+
for (let j = 0; j < num2; j++) {
|
|
2315
|
+
clusterSizes[j] = 0;
|
|
2316
|
+
}
|
|
2317
|
+
for (let i = 0; i < n; i++) {
|
|
2318
|
+
const value = values[i];
|
|
2319
|
+
let mindist = Number.MAX_VALUE;
|
|
2320
|
+
let best;
|
|
2321
|
+
for (let j = 0; j < num2; j++) {
|
|
2322
|
+
const dist = abs(centroids[j] - value);
|
|
2323
|
+
if (dist < mindist) {
|
|
2324
|
+
mindist = dist;
|
|
2325
|
+
best = j;
|
|
2326
|
+
}
|
|
2327
|
+
clusterSizes[best]++;
|
|
2328
|
+
assignments[i] = best;
|
|
2329
|
+
}
|
|
2330
|
+
}
|
|
2331
|
+
const newCentroids = new Array(num2);
|
|
2332
|
+
for (let j = 0; j < num2; j++) {
|
|
2333
|
+
newCentroids[j] = null;
|
|
2334
|
+
}
|
|
2335
|
+
for (let i = 0; i < n; i++) {
|
|
2336
|
+
cluster = assignments[i];
|
|
2337
|
+
if (newCentroids[cluster] === null) {
|
|
2338
|
+
newCentroids[cluster] = values[i];
|
|
2339
|
+
} else {
|
|
2340
|
+
newCentroids[cluster] += values[i];
|
|
2341
|
+
}
|
|
2342
|
+
}
|
|
2343
|
+
for (let j = 0; j < num2; j++) {
|
|
2344
|
+
newCentroids[j] *= 1 / clusterSizes[j];
|
|
2345
|
+
}
|
|
2346
|
+
repeat = false;
|
|
2347
|
+
for (let j = 0; j < num2; j++) {
|
|
2348
|
+
if (newCentroids[j] !== centroids[j]) {
|
|
2349
|
+
repeat = true;
|
|
2350
|
+
break;
|
|
2351
|
+
}
|
|
2352
|
+
}
|
|
2353
|
+
centroids = newCentroids;
|
|
2354
|
+
nb_iters++;
|
|
2355
|
+
if (nb_iters > 200) {
|
|
2356
|
+
repeat = false;
|
|
2357
|
+
}
|
|
2358
|
+
}
|
|
2359
|
+
const kClusters = {};
|
|
2360
|
+
for (let j = 0; j < num2; j++) {
|
|
2361
|
+
kClusters[j] = [];
|
|
2362
|
+
}
|
|
2363
|
+
for (let i = 0; i < n; i++) {
|
|
2364
|
+
cluster = assignments[i];
|
|
2365
|
+
kClusters[cluster].push(values[i]);
|
|
2366
|
+
}
|
|
2367
|
+
let tmpKMeansBreaks = [];
|
|
2368
|
+
for (let j = 0; j < num2; j++) {
|
|
2369
|
+
tmpKMeansBreaks.push(kClusters[j][0]);
|
|
2370
|
+
tmpKMeansBreaks.push(kClusters[j][kClusters[j].length - 1]);
|
|
2371
|
+
}
|
|
2372
|
+
tmpKMeansBreaks = tmpKMeansBreaks.sort((a, b) => a - b);
|
|
2373
|
+
limits2.push(tmpKMeansBreaks[0]);
|
|
2374
|
+
for (let i = 1; i < tmpKMeansBreaks.length; i += 2) {
|
|
2375
|
+
const v = tmpKMeansBreaks[i];
|
|
2376
|
+
if (!isNaN(v) && limits2.indexOf(v) === -1) {
|
|
2377
|
+
limits2.push(v);
|
|
2378
|
+
}
|
|
2379
|
+
}
|
|
2380
|
+
}
|
|
2381
|
+
return limits2;
|
|
2382
|
+
}
|
|
2383
|
+
|
|
2384
|
+
// ../../node_modules/chroma-js/src/utils/contrast.js
|
|
2385
|
+
var contrast_default = (a, b) => {
|
|
2386
|
+
a = new Color_default(a);
|
|
2387
|
+
b = new Color_default(b);
|
|
2388
|
+
const l1 = a.luminance();
|
|
2389
|
+
const l2 = b.luminance();
|
|
2390
|
+
return l1 > l2 ? (l1 + 0.05) / (l2 + 0.05) : (l2 + 0.05) / (l1 + 0.05);
|
|
2391
|
+
};
|
|
2392
|
+
|
|
2393
|
+
// ../../node_modules/chroma-js/src/utils/delta-e.js
|
|
2394
|
+
var { sqrt: sqrt5, pow: pow11, min: min4, max: max4, atan2: atan23, abs: abs2, cos: cos5, sin: sin4, exp, PI: PI3 } = Math;
|
|
2395
|
+
function delta_e_default(a, b, Kl = 1, Kc = 1, Kh = 1) {
|
|
2396
|
+
var rad2deg = function(rad) {
|
|
2397
|
+
return 360 * rad / (2 * PI3);
|
|
2398
|
+
};
|
|
2399
|
+
var deg2rad = function(deg) {
|
|
2400
|
+
return 2 * PI3 * deg / 360;
|
|
2401
|
+
};
|
|
2402
|
+
a = new Color_default(a);
|
|
2403
|
+
b = new Color_default(b);
|
|
2404
|
+
const [L1, a1, b1] = Array.from(a.lab());
|
|
2405
|
+
const [L2, a2, b2] = Array.from(b.lab());
|
|
2406
|
+
const avgL = (L1 + L2) / 2;
|
|
2407
|
+
const C1 = sqrt5(pow11(a1, 2) + pow11(b1, 2));
|
|
2408
|
+
const C2 = sqrt5(pow11(a2, 2) + pow11(b2, 2));
|
|
2409
|
+
const avgC = (C1 + C2) / 2;
|
|
2410
|
+
const G = 0.5 * (1 - sqrt5(pow11(avgC, 7) / (pow11(avgC, 7) + pow11(25, 7))));
|
|
2411
|
+
const a1p = a1 * (1 + G);
|
|
2412
|
+
const a2p = a2 * (1 + G);
|
|
2413
|
+
const C1p = sqrt5(pow11(a1p, 2) + pow11(b1, 2));
|
|
2414
|
+
const C2p = sqrt5(pow11(a2p, 2) + pow11(b2, 2));
|
|
2415
|
+
const avgCp = (C1p + C2p) / 2;
|
|
2416
|
+
const arctan1 = rad2deg(atan23(b1, a1p));
|
|
2417
|
+
const arctan2 = rad2deg(atan23(b2, a2p));
|
|
2418
|
+
const h1p = arctan1 >= 0 ? arctan1 : arctan1 + 360;
|
|
2419
|
+
const h2p = arctan2 >= 0 ? arctan2 : arctan2 + 360;
|
|
2420
|
+
const avgHp = abs2(h1p - h2p) > 180 ? (h1p + h2p + 360) / 2 : (h1p + h2p) / 2;
|
|
2421
|
+
const T = 1 - 0.17 * cos5(deg2rad(avgHp - 30)) + 0.24 * cos5(deg2rad(2 * avgHp)) + 0.32 * cos5(deg2rad(3 * avgHp + 6)) - 0.2 * cos5(deg2rad(4 * avgHp - 63));
|
|
2422
|
+
let deltaHp = h2p - h1p;
|
|
2423
|
+
deltaHp = abs2(deltaHp) <= 180 ? deltaHp : h2p <= h1p ? deltaHp + 360 : deltaHp - 360;
|
|
2424
|
+
deltaHp = 2 * sqrt5(C1p * C2p) * sin4(deg2rad(deltaHp) / 2);
|
|
2425
|
+
const deltaL = L2 - L1;
|
|
2426
|
+
const deltaCp = C2p - C1p;
|
|
2427
|
+
const sl = 1 + 0.015 * pow11(avgL - 50, 2) / sqrt5(20 + pow11(avgL - 50, 2));
|
|
2428
|
+
const sc = 1 + 0.045 * avgCp;
|
|
2429
|
+
const sh = 1 + 0.015 * avgCp * T;
|
|
2430
|
+
const deltaTheta = 30 * exp(-pow11((avgHp - 275) / 25, 2));
|
|
2431
|
+
const Rc = 2 * sqrt5(pow11(avgCp, 7) / (pow11(avgCp, 7) + pow11(25, 7)));
|
|
2432
|
+
const Rt = -Rc * sin4(2 * deg2rad(deltaTheta));
|
|
2433
|
+
const result = sqrt5(
|
|
2434
|
+
pow11(deltaL / (Kl * sl), 2) + pow11(deltaCp / (Kc * sc), 2) + pow11(deltaHp / (Kh * sh), 2) + Rt * (deltaCp / (Kc * sc)) * (deltaHp / (Kh * sh))
|
|
2435
|
+
);
|
|
2436
|
+
return max4(0, min4(100, result));
|
|
2437
|
+
}
|
|
2438
|
+
|
|
2439
|
+
// ../../node_modules/chroma-js/src/utils/distance.js
|
|
2440
|
+
function distance_default(a, b, mode = "lab") {
|
|
2441
|
+
a = new Color_default(a);
|
|
2442
|
+
b = new Color_default(b);
|
|
2443
|
+
const l1 = a.get(mode);
|
|
2444
|
+
const l2 = b.get(mode);
|
|
2445
|
+
let sum_sq = 0;
|
|
2446
|
+
for (let i in l1) {
|
|
2447
|
+
const d = (l1[i] || 0) - (l2[i] || 0);
|
|
2448
|
+
sum_sq += d * d;
|
|
2449
|
+
}
|
|
2450
|
+
return Math.sqrt(sum_sq);
|
|
2451
|
+
}
|
|
2452
|
+
|
|
2453
|
+
// ../../node_modules/chroma-js/src/utils/valid.js
|
|
2454
|
+
var valid_default = (...args) => {
|
|
2455
|
+
try {
|
|
2456
|
+
new Color_default(...args);
|
|
2457
|
+
return true;
|
|
2458
|
+
} catch (e) {
|
|
2459
|
+
return false;
|
|
2460
|
+
}
|
|
2461
|
+
};
|
|
2462
|
+
|
|
2463
|
+
// ../../node_modules/chroma-js/src/utils/scales.js
|
|
2464
|
+
var scales_default = {
|
|
2465
|
+
cool() {
|
|
2466
|
+
return scale_default([chroma_default.hsl(180, 1, 0.9), chroma_default.hsl(250, 0.7, 0.4)]);
|
|
2467
|
+
},
|
|
2468
|
+
hot() {
|
|
2469
|
+
return scale_default(["#000", "#f00", "#ff0", "#fff"], [0, 0.25, 0.75, 1]).mode(
|
|
2470
|
+
"rgb"
|
|
2471
|
+
);
|
|
2472
|
+
}
|
|
2473
|
+
};
|
|
2474
|
+
|
|
2475
|
+
// ../../node_modules/chroma-js/src/colors/colorbrewer.js
|
|
2476
|
+
var colorbrewer = {
|
|
2477
|
+
// sequential
|
|
2478
|
+
OrRd: ["#fff7ec", "#fee8c8", "#fdd49e", "#fdbb84", "#fc8d59", "#ef6548", "#d7301f", "#b30000", "#7f0000"],
|
|
2479
|
+
PuBu: ["#fff7fb", "#ece7f2", "#d0d1e6", "#a6bddb", "#74a9cf", "#3690c0", "#0570b0", "#045a8d", "#023858"],
|
|
2480
|
+
BuPu: ["#f7fcfd", "#e0ecf4", "#bfd3e6", "#9ebcda", "#8c96c6", "#8c6bb1", "#88419d", "#810f7c", "#4d004b"],
|
|
2481
|
+
Oranges: ["#fff5eb", "#fee6ce", "#fdd0a2", "#fdae6b", "#fd8d3c", "#f16913", "#d94801", "#a63603", "#7f2704"],
|
|
2482
|
+
BuGn: ["#f7fcfd", "#e5f5f9", "#ccece6", "#99d8c9", "#66c2a4", "#41ae76", "#238b45", "#006d2c", "#00441b"],
|
|
2483
|
+
YlOrBr: ["#ffffe5", "#fff7bc", "#fee391", "#fec44f", "#fe9929", "#ec7014", "#cc4c02", "#993404", "#662506"],
|
|
2484
|
+
YlGn: ["#ffffe5", "#f7fcb9", "#d9f0a3", "#addd8e", "#78c679", "#41ab5d", "#238443", "#006837", "#004529"],
|
|
2485
|
+
Reds: ["#fff5f0", "#fee0d2", "#fcbba1", "#fc9272", "#fb6a4a", "#ef3b2c", "#cb181d", "#a50f15", "#67000d"],
|
|
2486
|
+
RdPu: ["#fff7f3", "#fde0dd", "#fcc5c0", "#fa9fb5", "#f768a1", "#dd3497", "#ae017e", "#7a0177", "#49006a"],
|
|
2487
|
+
Greens: ["#f7fcf5", "#e5f5e0", "#c7e9c0", "#a1d99b", "#74c476", "#41ab5d", "#238b45", "#006d2c", "#00441b"],
|
|
2488
|
+
YlGnBu: ["#ffffd9", "#edf8b1", "#c7e9b4", "#7fcdbb", "#41b6c4", "#1d91c0", "#225ea8", "#253494", "#081d58"],
|
|
2489
|
+
Purples: ["#fcfbfd", "#efedf5", "#dadaeb", "#bcbddc", "#9e9ac8", "#807dba", "#6a51a3", "#54278f", "#3f007d"],
|
|
2490
|
+
GnBu: ["#f7fcf0", "#e0f3db", "#ccebc5", "#a8ddb5", "#7bccc4", "#4eb3d3", "#2b8cbe", "#0868ac", "#084081"],
|
|
2491
|
+
Greys: ["#ffffff", "#f0f0f0", "#d9d9d9", "#bdbdbd", "#969696", "#737373", "#525252", "#252525", "#000000"],
|
|
2492
|
+
YlOrRd: ["#ffffcc", "#ffeda0", "#fed976", "#feb24c", "#fd8d3c", "#fc4e2a", "#e31a1c", "#bd0026", "#800026"],
|
|
2493
|
+
PuRd: ["#f7f4f9", "#e7e1ef", "#d4b9da", "#c994c7", "#df65b0", "#e7298a", "#ce1256", "#980043", "#67001f"],
|
|
2494
|
+
Blues: ["#f7fbff", "#deebf7", "#c6dbef", "#9ecae1", "#6baed6", "#4292c6", "#2171b5", "#08519c", "#08306b"],
|
|
2495
|
+
PuBuGn: ["#fff7fb", "#ece2f0", "#d0d1e6", "#a6bddb", "#67a9cf", "#3690c0", "#02818a", "#016c59", "#014636"],
|
|
2496
|
+
Viridis: ["#440154", "#482777", "#3f4a8a", "#31678e", "#26838f", "#1f9d8a", "#6cce5a", "#b6de2b", "#fee825"],
|
|
2497
|
+
// diverging
|
|
2498
|
+
Spectral: ["#9e0142", "#d53e4f", "#f46d43", "#fdae61", "#fee08b", "#ffffbf", "#e6f598", "#abdda4", "#66c2a5", "#3288bd", "#5e4fa2"],
|
|
2499
|
+
RdYlGn: ["#a50026", "#d73027", "#f46d43", "#fdae61", "#fee08b", "#ffffbf", "#d9ef8b", "#a6d96a", "#66bd63", "#1a9850", "#006837"],
|
|
2500
|
+
RdBu: ["#67001f", "#b2182b", "#d6604d", "#f4a582", "#fddbc7", "#f7f7f7", "#d1e5f0", "#92c5de", "#4393c3", "#2166ac", "#053061"],
|
|
2501
|
+
PiYG: ["#8e0152", "#c51b7d", "#de77ae", "#f1b6da", "#fde0ef", "#f7f7f7", "#e6f5d0", "#b8e186", "#7fbc41", "#4d9221", "#276419"],
|
|
2502
|
+
PRGn: ["#40004b", "#762a83", "#9970ab", "#c2a5cf", "#e7d4e8", "#f7f7f7", "#d9f0d3", "#a6dba0", "#5aae61", "#1b7837", "#00441b"],
|
|
2503
|
+
RdYlBu: ["#a50026", "#d73027", "#f46d43", "#fdae61", "#fee090", "#ffffbf", "#e0f3f8", "#abd9e9", "#74add1", "#4575b4", "#313695"],
|
|
2504
|
+
BrBG: ["#543005", "#8c510a", "#bf812d", "#dfc27d", "#f6e8c3", "#f5f5f5", "#c7eae5", "#80cdc1", "#35978f", "#01665e", "#003c30"],
|
|
2505
|
+
RdGy: ["#67001f", "#b2182b", "#d6604d", "#f4a582", "#fddbc7", "#ffffff", "#e0e0e0", "#bababa", "#878787", "#4d4d4d", "#1a1a1a"],
|
|
2506
|
+
PuOr: ["#7f3b08", "#b35806", "#e08214", "#fdb863", "#fee0b6", "#f7f7f7", "#d8daeb", "#b2abd2", "#8073ac", "#542788", "#2d004b"],
|
|
2507
|
+
// qualitative
|
|
2508
|
+
Set2: ["#66c2a5", "#fc8d62", "#8da0cb", "#e78ac3", "#a6d854", "#ffd92f", "#e5c494", "#b3b3b3"],
|
|
2509
|
+
Accent: ["#7fc97f", "#beaed4", "#fdc086", "#ffff99", "#386cb0", "#f0027f", "#bf5b17", "#666666"],
|
|
2510
|
+
Set1: ["#e41a1c", "#377eb8", "#4daf4a", "#984ea3", "#ff7f00", "#ffff33", "#a65628", "#f781bf", "#999999"],
|
|
2511
|
+
Set3: ["#8dd3c7", "#ffffb3", "#bebada", "#fb8072", "#80b1d3", "#fdb462", "#b3de69", "#fccde5", "#d9d9d9", "#bc80bd", "#ccebc5", "#ffed6f"],
|
|
2512
|
+
Dark2: ["#1b9e77", "#d95f02", "#7570b3", "#e7298a", "#66a61e", "#e6ab02", "#a6761d", "#666666"],
|
|
2513
|
+
Paired: ["#a6cee3", "#1f78b4", "#b2df8a", "#33a02c", "#fb9a99", "#e31a1c", "#fdbf6f", "#ff7f00", "#cab2d6", "#6a3d9a", "#ffff99", "#b15928"],
|
|
2514
|
+
Pastel2: ["#b3e2cd", "#fdcdac", "#cbd5e8", "#f4cae4", "#e6f5c9", "#fff2ae", "#f1e2cc", "#cccccc"],
|
|
2515
|
+
Pastel1: ["#fbb4ae", "#b3cde3", "#ccebc5", "#decbe4", "#fed9a6", "#ffffcc", "#e5d8bd", "#fddaec", "#f2f2f2"]
|
|
2516
|
+
};
|
|
2517
|
+
for (let key of Object.keys(colorbrewer)) {
|
|
2518
|
+
colorbrewer[key.toLowerCase()] = colorbrewer[key];
|
|
2519
|
+
}
|
|
2520
|
+
var colorbrewer_default = colorbrewer;
|
|
2521
|
+
|
|
2522
|
+
// ../../node_modules/chroma-js/index.js
|
|
2523
|
+
Object.assign(chroma_default, {
|
|
2524
|
+
average: average_default,
|
|
2525
|
+
bezier: bezier_default,
|
|
2526
|
+
blend: blend_default,
|
|
2527
|
+
cubehelix: cubehelix_default,
|
|
2528
|
+
mix: mix_default,
|
|
2529
|
+
interpolate: mix_default,
|
|
2530
|
+
random: random_default,
|
|
2531
|
+
scale: scale_default,
|
|
2532
|
+
analyze,
|
|
2533
|
+
contrast: contrast_default,
|
|
2534
|
+
deltaE: delta_e_default,
|
|
2535
|
+
distance: distance_default,
|
|
2536
|
+
limits,
|
|
2537
|
+
valid: valid_default,
|
|
2538
|
+
scales: scales_default,
|
|
2539
|
+
input: input_default,
|
|
2540
|
+
colors: w3cx11_default,
|
|
2541
|
+
brewer: colorbrewer_default
|
|
2542
|
+
});
|
|
2543
|
+
var chroma_js_default = chroma_default;
|
|
2544
|
+
|
|
52
2545
|
// src/protocol/brandResolver.ts
|
|
53
2546
|
var BRAND_REF_PATTERN = /^\{!\$brand\.([^}]+)\}$/;
|
|
54
2547
|
var MAX_RESOLVE_DEPTH = 10;
|
|
@@ -111,6 +2604,35 @@
|
|
|
111
2604
|
function formatDimension(dim) {
|
|
112
2605
|
return `${dim.value}${dim.unit}`;
|
|
113
2606
|
}
|
|
2607
|
+
var OKLCH_DISPLAY_VARS = [
|
|
2608
|
+
"--tm-color-primary",
|
|
2609
|
+
"--tm-color-secondary",
|
|
2610
|
+
"--tm-color-accent",
|
|
2611
|
+
"--tm-color-background",
|
|
2612
|
+
"--tm-color-surface"
|
|
2613
|
+
];
|
|
2614
|
+
function toOklchString(color) {
|
|
2615
|
+
if (!color || !chroma_js_default.valid(color)) return void 0;
|
|
2616
|
+
try {
|
|
2617
|
+
const [l, c, h] = chroma_js_default(color).oklch();
|
|
2618
|
+
const L = Number(l.toFixed(2));
|
|
2619
|
+
const C = Number(c.toFixed(3));
|
|
2620
|
+
const H = Number.isNaN(h) ? 0 : Number(h.toFixed(0));
|
|
2621
|
+
return `oklch(${L} ${C} ${H})`;
|
|
2622
|
+
} catch {
|
|
2623
|
+
return void 0;
|
|
2624
|
+
}
|
|
2625
|
+
}
|
|
2626
|
+
function oklchDisplayVars(variables) {
|
|
2627
|
+
const out = {};
|
|
2628
|
+
for (const colorVar of OKLCH_DISPLAY_VARS) {
|
|
2629
|
+
const oklch2 = toOklchString(variables[colorVar]);
|
|
2630
|
+
if (oklch2) {
|
|
2631
|
+
out[`${colorVar}-oklch`] = `"${oklch2}"`;
|
|
2632
|
+
}
|
|
2633
|
+
}
|
|
2634
|
+
return out;
|
|
2635
|
+
}
|
|
114
2636
|
function buildFontStack(font) {
|
|
115
2637
|
if (typeof font === "string" && font.startsWith("{!$brand")) {
|
|
116
2638
|
return "system-ui, -apple-system, sans-serif";
|
|
@@ -341,6 +2863,10 @@
|
|
|
341
2863
|
if (brand.borderWeight?.none) {
|
|
342
2864
|
vars["--tm-border-weight-none"] = formatDimension(brand.borderWeight.none);
|
|
343
2865
|
}
|
|
2866
|
+
Object.assign(vars, oklchDisplayVars(vars));
|
|
2867
|
+
if (vars["--tm-border-radius"]) {
|
|
2868
|
+
vars["--tm-border-radius-label"] = `"${vars["--tm-border-radius"]}"`;
|
|
2869
|
+
}
|
|
344
2870
|
return vars;
|
|
345
2871
|
}
|
|
346
2872
|
|