@a_ng_d/utils-ui-color-palette 1.5.15 → 1.6.1

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.
@@ -1,1079 +1,266 @@
1
- var N = Object.defineProperty;
2
- var w = (m, l, n) => l in m ? N(m, l, { enumerable: !0, configurable: !0, writable: !0, value: n }) : m[l] = n;
3
- var k = (m, l, n) => w(m, typeof l != "symbol" ? l + "" : l, n);
4
- import { C as x, H as M } from "../../color-1CXTuV84.js";
5
- import { c as u } from "../../index-Beb8qoyd.js";
6
- const S = (m) => {
7
- const l = m.themes.filter((a) => a.type === "custom theme").length === 0 ? m.themes.filter((a) => a.type === "default theme") : m.themes.filter((a) => a.type === "custom theme"), n = {}, t = (a) => (isNaN(a.hsl[0]) && (a.hsl[0] = 0), isNaN(a.lch[2]) && (a.lch[2] = 0), isNaN(a.oklch[2]) && (a.oklch[2] = 0), {
8
- rgb: {
9
- r: Math.floor(a.rgb[0]),
10
- g: Math.floor(a.rgb[1]),
11
- b: Math.floor(a.rgb[2])
12
- },
13
- gl: {
14
- r: parseFloat(a.gl[0].toFixed(3)),
15
- g: parseFloat(a.gl[1].toFixed(3)),
16
- b: parseFloat(a.gl[2].toFixed(3))
17
- },
18
- lch: {
19
- l: Math.floor(a.lch[0]),
20
- c: Math.floor(a.lch[1]),
21
- h: Math.floor(a.lch[2])
22
- },
23
- oklch: {
24
- l: parseFloat(a.oklch[0].toFixed(3)),
25
- c: parseFloat(a.oklch[1].toFixed(3)),
26
- h: Math.floor(a.oklch[2])
27
- },
28
- lab: {
29
- l: Math.floor(a.lab[0]),
30
- a: Math.floor(a.lab[1]),
31
- b: Math.floor(a.lab[2])
32
- },
33
- oklab: {
34
- l: parseFloat(a.oklab[0].toFixed(3)),
35
- a: parseFloat(a.oklab[1].toFixed(3)),
36
- b: parseFloat(a.oklab[2].toFixed(3))
37
- },
38
- hsl: {
39
- h: Math.floor(a.hsl[0]),
40
- s: Math.floor(a.hsl[1] * 100),
41
- l: Math.floor(a.hsl[2] * 100)
42
- },
43
- hsluv: {
44
- h: Math.floor(a.hsluv[0]),
45
- s: Math.floor(a.hsluv[1]),
46
- l: Math.floor(a.hsluv[2])
47
- },
48
- hex: a.hex,
49
- description: a.description,
50
- type: "color shade/tint"
51
- }), i = (a, e) => ({
52
- rgb: {
53
- r: Math.floor(e.rgb[0]),
54
- g: Math.floor(e.rgb[1]),
55
- b: Math.floor(e.rgb[2])
56
- },
57
- gl: {
58
- r: parseFloat(e.gl[0].toFixed(3)),
59
- g: parseFloat(e.gl[1].toFixed(3)),
60
- b: parseFloat(e.gl[2].toFixed(3))
61
- },
62
- lch: {
63
- l: Math.floor(e.lch[0]),
64
- c: Math.floor(e.lch[1]),
65
- h: Math.floor(e.lch[2])
66
- },
67
- oklch: {
68
- l: parseFloat(e.oklch[0].toFixed(3)),
69
- c: parseFloat(e.oklch[1].toFixed(3)),
70
- h: Math.floor(e.oklch[2])
71
- },
72
- lab: {
73
- l: Math.floor(e.lab[0]),
74
- a: Math.floor(e.lab[1]),
75
- b: Math.floor(e.lab[2])
76
- },
77
- oklab: {
78
- l: parseFloat(e.oklab[0].toFixed(3)),
79
- a: parseFloat(e.oklab[1].toFixed(3)),
80
- b: parseFloat(e.oklab[2].toFixed(3))
81
- },
82
- hsl: {
83
- h: Math.floor(e.hsl[0]),
84
- s: Math.floor(e.hsl[1] * 100),
85
- l: Math.floor(e.hsl[2] * 100)
86
- },
87
- hsluv: {
88
- h: Math.floor(e.hsluv[0]),
89
- s: Math.floor(e.hsluv[1]),
90
- l: Math.floor(e.hsluv[2])
91
- },
92
- hex: e.hex,
93
- alpha: a.alpha,
94
- description: a.description,
95
- type: "color shade/tint"
96
- });
97
- return l[0].type === "custom theme" ? l.forEach((a) => {
98
- n[a.name] = {}, a.colors.forEach((e) => {
99
- const o = e.shades.find(
100
- (c) => c.type === "source color"
101
- );
102
- n[a.name][e.name] = {}, e.shades.forEach((c) => {
103
- c && o && (n[a.name][e.name][c.name] = c.isTransparent ? i(c, o) : t(c));
104
- }), n[a.name][e.name].description = e.description, n[a.name][e.name].type = "color";
105
- }), n[a.name].description = a.description, n[a.name].type = "color mode";
106
- }) : l.forEach((a) => {
107
- a.colors.forEach((e) => {
108
- const o = e.shades.find(
109
- (c) => c.type === "source color"
110
- );
111
- n[e.name] = {}, e.shades.forEach((c) => {
112
- c && o && (n[e.name][c.name] = c.isTransparent ? i(c, o) : t(c));
113
- }), n[e.name].description = e.description, n[e.name].type = "color";
114
- });
115
- }), n.description = m.description, n.type = "color palette", JSON.stringify(n, null, " ");
116
- };
117
- var v = Object.defineProperty, T = (m, l, n) => l in m ? v(m, l, { enumerable: !0, configurable: !0, writable: !0, value: n }) : m[l] = n, y = (m, l, n) => T(m, typeof l != "symbol" ? l + "" : l, n);
118
- class b {
119
- constructor(l) {
120
- y(this, "string"), y(this, "doSnakeCase", () => this.string.toLowerCase().split(" ").join("_").replace(/[@/$^%#&!?.,;:+=<>(){}"«»]/g, "")), y(this, "doPascalCase", () => this.string.charAt(0).toUpperCase() + this.string.toLowerCase().replace(/[^a-zA-Z0-9]+(.)/g, (n) => n.toUpperCase()).replace(/[@/$^%#&!?.,;:+=<>(){}"«» ]/g, "").slice(1)), y(this, "doKebabCase", () => this.string.toLowerCase().split(" ").join("-").replace(/[@/$^%#&!?.,;:+=<>(){}"«»]/g, "")), y(this, "doCamelCase", () => this.string.toLowerCase().replace(/[^a-zA-Z0-9]+(.)/g, (n) => n.toUpperCase()).replace(/[@/$^%#&!?.,;:+=<>(){}"«» ]/g, "")), this.string = l;
121
- }
122
- }
123
- const L = (m) => {
124
- const l = m.themes.filter((t) => t.type === "custom theme").length === 0 ? m.themes.filter((t) => t.type === "default theme") : m.themes.filter((t) => t.type === "custom theme"), n = [];
125
- return l.forEach((t) => {
126
- const i = [];
127
- t.colors.forEach((a) => {
128
- const e = a.shades.find((o) => o.type === "source color");
129
- i.push(`// ${a.name}`), a.shades.reverse().forEach((o) => {
130
- i.push(
131
- o.isTransparent ? `static let ${new b(a.name).doPascalCase()}${o.name === "source" ? "Source" : o.name} = UIColor(red: ${e == null ? void 0 : e.gl[0].toFixed(
132
- 3
133
- )}, green: ${e == null ? void 0 : e.gl[1].toFixed(3)}, blue: ${e == null ? void 0 : e.gl[2].toFixed(
134
- 3
135
- )}, alpha: ${o.alpha ?? 1})` : `static let ${new b(a.name).doPascalCase()}${o.name === "source" ? "Source" : o.name} = UIColor(red: ${o.gl[0].toFixed(
136
- 3
137
- )}, green: ${o.gl[1].toFixed(3)}, blue: ${o.gl[2].toFixed(
138
- 3
139
- )})`
140
- );
141
- }), i.push("");
142
- }), i.pop(), l[0].type === "custom theme" ? n.push(
143
- `// ${t.name}
144
- struct ${new b(t.name).doPascalCase()} {
145
- ${i.join(
146
- `
147
- `
148
- )}
149
- }`
150
- ) : n.push(`${i.join(`
151
- `)}`);
152
- }), `import UIKit
153
-
154
- struct Color {
155
- ${n.join(`
156
-
157
- `)}
158
- }`;
159
- }, H = (m) => {
160
- const l = m.themes.filter((t) => t.type === "custom theme").length === 0 ? m.themes.filter((t) => t.type === "default theme") : m.themes.filter((t) => t.type === "custom theme");
161
- let n = `@import "tailwindcss";
162
-
163
- @theme {
164
- --color-*: initial;
165
-
166
- `;
167
- return l[0].type !== "custom theme" ? l.forEach((t) => {
168
- t.colors.forEach((i) => {
169
- const a = i.shades.find(
170
- (r) => r.type === "source color"
171
- ), e = new b(i.name).doKebabCase();
172
- n += ` /* ${i.name} */
173
- `, i.shades.sort().forEach((r) => {
174
- const h = r.isTransparent ? u((a == null ? void 0 : a.hex) ?? "#000000").alpha(r.alpha ?? 1).hex() : r.hex, s = new b(r.name).doKebabCase();
175
- n += ` --color-${e}-${s}: ${h};
176
- `;
177
- });
178
- const o = i === t.colors[t.colors.length - 1], c = t === l[l.length - 1];
179
- o && c || (n += `
180
- `);
181
- });
182
- }) : l.forEach((t) => {
183
- const i = new b(t.name).doKebabCase();
184
- t.colors.forEach((a) => {
185
- const e = a.shades.find(
186
- (h) => h.type === "source color"
187
- ), o = new b(a.name).doKebabCase();
188
- n += ` /* ${t.name} - ${a.name} */
189
- `, a.shades.forEach((h) => {
190
- const s = h.isTransparent ? u((e == null ? void 0 : e.hex) ?? "#000000").alpha(h.alpha ?? 1).hex() : h.hex, p = new b(h.name).doKebabCase();
191
- n += ` --color-${i}-${o}-${p}: ${s};
192
- `;
193
- });
194
- const c = a === t.colors[t.colors.length - 1], r = t === l[l.length - 1];
195
- c && r || (n += `
196
- `);
197
- });
198
- }), n += `}
199
- `, n;
200
- }, K = (m) => {
201
- const l = m.themes.filter((t) => t.type === "custom theme").length === 0 ? m.themes.filter((t) => t.type === "default theme") : m.themes.filter((t) => t.type === "custom theme"), n = {
202
- theme: {
203
- colors: {}
204
- }
205
- };
206
- return m.themes[0].colors.forEach((t) => {
207
- n.theme.colors[new b(t.name).doKebabCase()] = {};
208
- }), l[0].type === "custom theme" ? l.forEach((t) => {
209
- t.colors.forEach((i) => {
210
- const a = i.shades.find(
211
- (e) => e.type === "source color"
212
- );
213
- n.theme.colors[new b(i.name).doKebabCase()][new b(t.name).doKebabCase()] = {}, i.shades.forEach((e) => {
214
- n.theme.colors[new b(i.name).doKebabCase()][new b(t.name).doKebabCase()][new b(e.name).doKebabCase()] = e.isTransparent ? u((a == null ? void 0 : a.hex) ?? "#000000").alpha(e.alpha ?? 1).hex() : e.hex;
215
- });
216
- });
217
- }) : l.forEach((t) => {
218
- t.colors.forEach((i) => {
219
- const a = i.shades.find(
220
- (e) => e.type === "source color"
221
- );
222
- n.theme.colors[new b(i.name).doKebabCase()] = {}, i.shades.sort().forEach((e) => {
223
- n.theme.colors[new b(i.name).doKebabCase()][new b(e.name).doKebabCase()] = e.isTransparent ? u((a == null ? void 0 : a.hex) ?? "#000000").alpha(e.alpha ?? 1).hex() : e.hex;
224
- });
225
- });
226
- }), `module.exports = ${JSON.stringify(n, null, " ")}`;
227
- }, A = (m) => {
228
- const l = m.themes.filter((t) => t.type === "custom theme").length === 0 ? m.themes.filter((t) => t.type === "default theme") : m.themes.filter((t) => t.type === "custom theme"), n = [];
229
- return l.forEach((t) => {
230
- t.colors.forEach((i) => {
231
- const a = i.shades.find((o) => o.type === "source color"), e = [];
232
- e.push(
233
- `// ${l[0].type === "custom theme" ? t.name + " - " : ""}${i.name}`
234
- ), i.shades.reverse().forEach((o) => {
235
- e.push(
236
- o.isTransparent ? `public let ${l[0].type === "custom theme" ? new b(t.name + " " + i.name).doPascalCase() : new b(i.name).doPascalCase()}${o.name === "source" ? "Source" : o.name} = Color(red: ${a == null ? void 0 : a.gl[0].toFixed(
237
- 3
238
- )}, green: ${a == null ? void 0 : a.gl[1].toFixed(3)}, blue: ${o.gl[2].toFixed(
239
- 3
240
- )}).opacity(${o.alpha ?? 1})` : `public let ${l[0].type === "custom theme" ? new b(t.name + " " + i.name).doPascalCase() : new b(i.name).doPascalCase()}${o.name === "source" ? "Source" : o.name} = Color(red: ${o.gl[0].toFixed(
241
- 3
242
- )}, green: ${o.gl[1].toFixed(3)}, blue: ${o.gl[2].toFixed(
243
- 3
244
- )})`
245
- );
246
- }), e.push(""), e.forEach((o) => n.push(o));
247
- });
248
- }), n.pop(), `import SwiftUI
249
-
250
- public extension Color {
251
- static let Token = Color.TokenColor()
252
- struct TokenColor {
253
- ${n.join(
254
- `
255
- `
256
- )}
257
- }
258
- }`;
259
- }, V = (m) => {
260
- const l = m.themes.filter((i) => i.type === "custom theme").length === 0 ? m.themes.filter((i) => i.type === "default theme") : m.themes.filter((i) => i.type === "custom theme"), n = {
261
- color: {}
262
- }, t = (i, a, e) => ({
263
- type: "color",
264
- value: a.isTransparent ? u(e.hex).alpha(a.alpha ?? 1).hex() : a.hex,
265
- comment: i.description !== "" ? i.description + " - " + a.description : a.description
266
- });
267
- return m.themes[0].colors.forEach((i) => {
268
- n.color[i.name] = {};
269
- }), l[0].type === "custom theme" ? l.forEach((i) => {
270
- i.colors.forEach((a) => {
271
- const e = a.shades.find(
272
- (o) => o.type === "source color"
273
- );
274
- n.color[a.name][i.name] = {}, a.shades.forEach((o) => {
275
- o && e && (n.color[a.name][i.name][o.name] = t(
276
- a,
277
- o,
278
- e
279
- ));
280
- });
281
- });
282
- }) : l.forEach((i) => {
283
- i.colors.forEach((a) => {
284
- const e = a.shades.find(
285
- (o) => o.type === "source color"
286
- );
287
- n.color[a.name] = {}, a.shades.forEach((o) => {
288
- o && e && (n.color[a.name][o.name] = t(a, o, e));
289
- });
290
- });
291
- }), JSON.stringify(n, null, " ");
292
- }, P = (m, l) => {
293
- const n = m.themes.filter((s) => s.type === "custom theme").length === 0 ? m.themes.filter((s) => s.type === "default theme") : m.themes.filter((s) => s.type === "custom theme"), t = [], i = [], a = (s) => {
294
- var f;
295
- isNaN(s.hsl[0]) && (s.hsl[0] = 0), isNaN(s.lch[2]) && (s.lch[2] = 0), isNaN(s.oklch[2]) && (s.oklch[2] = 0);
296
- const p = {
297
- RGB: () => `rgb(${Math.floor(s.rgb[0])}, ${Math.floor(
298
- s.rgb[1]
299
- )}, ${Math.floor(s.rgb[2])})`,
300
- HEX: () => s.hex,
301
- HSL: () => `hsl(${Math.floor(s.hsl[0])} ${Math.floor(
302
- s.hsl[1] * 100
303
- )}% ${Math.floor(s.hsl[2] * 100)}%)`,
304
- LCH: () => `lch(${Math.floor(s.lch[0])}% ${Math.floor(
305
- s.lch[1]
306
- )} ${Math.floor(s.lch[2])})`,
307
- OKLCH: () => `oklch(${Math.floor(s.oklch[0] * 100)}% ${s.oklch[1].toFixed(3)} ${Math.floor(s.oklch[2])})`
308
- };
309
- return (f = p[l ?? "RGB"]) == null ? void 0 : f.call(p);
310
- }, e = (s, p) => {
311
- var $;
312
- isNaN(s.hsl[0]) && (s.hsl[0] = 0), isNaN(s.lch[2]) && (s.lch[2] = 0), isNaN(s.oklch[2]) && (s.oklch[2] = 0);
313
- const f = {
314
- RGB: () => {
315
- var g;
316
- return `rgba(${Math.floor(p.rgb[0])}, ${Math.floor(
317
- p.rgb[1]
318
- )}, ${Math.floor(p.rgb[2])}, ${((g = s.alpha) == null ? void 0 : g.toFixed(2)) ?? 1})`;
319
- },
320
- HEX: () => u(p.hex).alpha(s.alpha ?? 1).hex(),
321
- HSL: () => {
322
- var g;
323
- return `hsla(${Math.floor(p.hsl[0])} ${Math.floor(
324
- p.hsl[1] * 100
325
- )}%, ${Math.floor(p.hsl[2] * 100)}% ${((g = s.alpha) == null ? void 0 : g.toFixed(2)) ?? 1})`;
326
- },
327
- LCH: () => {
328
- var g;
329
- return `lch(${Math.floor(p.lch[0])}% ${Math.floor(
330
- p.lch[1]
331
- )} ${Math.floor(p.lch[2])} / ${((g = s.alpha) == null ? void 0 : g.toFixed(2)) ?? 1})`;
332
- },
333
- OKLCH: () => {
334
- var g;
335
- return `oklch(${Math.floor(p.oklch[0 * 100])}% ${p.oklch[1].toFixed(3)} ${Math.floor(p.oklch[2])} / ${((g = s.alpha) == null ? void 0 : g.toFixed(2)) ?? 1})`;
336
- }
337
- };
338
- return ($ = f[l ?? "RGB"]) == null ? void 0 : $.call(f);
339
- }, o = n.find(
340
- (s) => s.type === "default theme"
341
- );
342
- if (o) {
343
- const s = [];
344
- return o.colors.forEach((p, f) => {
345
- f > 0 && s.push(""), s.push(`// ${p.name}`), p.shades.reverse().forEach(($) => {
346
- const g = p.shades.find((C) => C.type === "source color"), d = `$${new b(p.name).doKebabCase()}-${$.name}`;
347
- g && s.push(
348
- `${d}: ${$.isTransparent ? e($, g) : a($)};`
349
- );
350
- });
351
- }), t.push(s.join(`
352
- `)), t.join(`
353
- `);
354
- }
355
- n.forEach((s) => {
356
- const p = new b(s.name).doKebabCase(), f = [];
357
- f.push(`// ${s.name}`), f.push(`@mixin ${p} {`), s.colors.forEach(($, g) => {
358
- g > 0 && f.push(""), f.push(` // ${$.name}`), $.shades.reverse().forEach((d) => {
359
- const C = $.shades.find((F) => F.type === "source color"), E = `--${new b($.name).doKebabCase()}-${d.name}`;
360
- C && f.push(
361
- ` ${E}: ${d.isTransparent ? e(d, C) : a(d)};`
362
- );
363
- });
364
- }), f.push("}"), t.push(f.join(`
365
- `));
366
- });
367
- const c = /* @__PURE__ */ new Set();
368
- if (n.forEach((s) => {
369
- s.colors.forEach((p) => {
370
- p.shades.forEach((f) => {
371
- if (p.shades.find((g) => g.type === "source color")) {
372
- const d = `--${new b(p.name).doKebabCase()}-${f.name}`;
373
- c.add(d);
374
- }
375
- });
376
- });
377
- }), c.size > 0) {
378
- const s = /* @__PURE__ */ new Map();
379
- c.forEach((p) => {
380
- const f = p.match(/--([a-zA-Z0-9-]+)-([a-zA-Z0-9-]+)/);
381
- if (f) {
382
- const $ = f[1];
383
- s.has($) || s.set($, []);
384
- const g = `$${p.substring(2)}`;
385
- s.get($).push(`${g}: var(${p});`);
386
- }
387
- }), s.forEach((p, f) => {
388
- i.push(
389
- `// ${f.charAt(0).toUpperCase() + f.slice(1)}`
390
- ), i.push(...p), i.push("");
391
- }), i.length > 0 && i[i.length - 1] === "" && i.pop(), t.push(i.join(`
392
- `));
393
- }
394
- const r = [":root {"];
395
- n.forEach((s, p) => {
396
- const f = new b(s.name).doKebabCase();
397
- r.push(` &[data-theme="${f}"] {
398
- @include ${f};
399
- }`), p !== n.length - 1 && r.push("");
400
- }), r.push("}"), t.push(r.join(`
401
- `));
402
- const h = [];
403
- return n.forEach((s) => {
404
- const p = new b(s.name).doKebabCase();
405
- h.push(`.${p} {
406
- @include ${p};
407
- }`);
408
- }), t.push(h.join(`
409
-
410
- `)), t.join(`
411
-
412
- `);
413
- }, j = (m) => {
414
- const l = m.themes.filter((t) => t.type === "custom theme").length === 0 ? m.themes.filter((t) => t.type === "default theme") : m.themes.filter((t) => t.type === "custom theme"), n = [];
415
- return l.forEach((t) => {
416
- t.colors.forEach((i) => {
417
- const a = i.shades.find((o) => o.type === "source color"), e = [];
418
- e.push(
419
- `<!--${l[0].type === "custom theme" ? `${t.name} - ${i.name}-->` : `${i.name}-->`}`
420
- ), i.shades.reverse().forEach((o) => {
421
- e.push(
422
- `<color name="${l[0].type === "custom theme" ? new b(t.name + " " + i.name).doSnakeCase() : new b(i.name).doSnakeCase()}_${o.name}">${o.isTransparent ? u((a == null ? void 0 : a.hex) ?? "#000000").alpha(o.alpha ?? 1).hex() : o.hex}</color>`
423
- );
424
- }), e.push(""), e.forEach((o) => n.push(o));
425
- });
426
- }), n.pop(), `<?xml version="1.0" encoding="utf-8"?>
427
- <resources>
428
- ${n.join(
429
- `
430
- `
431
- )}
432
- </resources>`;
433
- }, B = (m) => {
434
- const l = m.themes.filter((a) => a.type === "custom theme").length === 0 ? m.themes.filter((a) => a.type === "default theme") : m.themes.filter((a) => a.type === "custom theme"), n = {
435
- $themes: [],
436
- $metadata: {
437
- activeThemes: [],
438
- tokenSetOrder: [],
439
- activeSets: []
440
- }
441
- }, t = m.name, i = (a, e, o) => ({
442
- $type: "color",
443
- $value: e.isTransparent ? u(o.hex).alpha(e.alpha ?? 1).hex() : e.hex,
444
- $description: a.description !== "" ? a.description + " - " + e.description : e.description
445
- });
446
- return l[0].type === "custom theme" ? l.forEach((a) => {
447
- a.colors.forEach((e) => {
448
- const o = e.shades.find(
449
- (c) => c.type === "source color"
450
- );
451
- n[`${a.name}/${e.name}`] = {}, e.shades.forEach((c) => {
452
- c && o && (n[`${a.name}/${e.name}`][c.name] = i(
453
- e,
454
- c,
455
- o
456
- ));
457
- });
458
- });
459
- }) : l.forEach((a) => {
460
- a.colors.forEach((e) => {
461
- const o = e.shades.find(
462
- (c) => c.type === "source color"
463
- );
464
- n[`${t}/${e.name}`] = {}, e.shades.forEach((c) => {
465
- c && o && (n[`${t}/${e.name}`][c.name] = i(
466
- e,
467
- c,
468
- o
469
- ));
470
- });
471
- });
472
- }), JSON.stringify(n, null, " ");
473
- }, R = (m, l) => {
474
- const n = m.themes.filter((r) => r.type === "custom theme").length === 0 ? m.themes.filter((r) => r.type === "default theme") : m.themes.filter((r) => r.type === "custom theme"), t = [], i = (r) => {
475
- var s;
476
- isNaN(r.hsl[0]) && (r.hsl[0] = 0), isNaN(r.lch[2]) && (r.lch[2] = 0), isNaN(r.oklch[2]) && (r.oklch[2] = 0);
477
- const h = {
478
- RGB: () => `rgb(${Math.floor(r.rgb[0])}, ${Math.floor(
479
- r.rgb[1]
480
- )}, ${Math.floor(r.rgb[2])})`,
481
- HEX: () => r.hex,
482
- HSL: () => `hsl(${Math.floor(r.hsl[0])} ${Math.floor(
483
- r.hsl[1] * 100
484
- )}% ${Math.floor(r.hsl[2] * 100)}%)`,
485
- LCH: () => `lch(${Math.floor(r.lch[0])}% ${Math.floor(
486
- r.lch[1]
487
- )} ${Math.floor(r.lch[2])})`,
488
- OKLCH: () => `oklch(${Math.floor(r.oklch[0] * 100)}% ${r.oklch[1].toFixed(3)} ${Math.floor(r.oklch[2])})`
489
- };
490
- return (s = h[l ?? "RGB"]) == null ? void 0 : s.call(h);
491
- }, a = (r, h) => {
492
- var p;
493
- isNaN(r.hsl[0]) && (r.hsl[0] = 0), isNaN(r.lch[2]) && (r.lch[2] = 0), isNaN(r.oklch[2]) && (r.oklch[2] = 0);
494
- const s = {
495
- RGB: () => {
496
- var f;
497
- return `rgba(${Math.floor(h.rgb[0])}, ${Math.floor(
498
- h.rgb[1]
499
- )}, ${Math.floor(h.rgb[2])}, ${((f = r.alpha) == null ? void 0 : f.toFixed(2)) ?? 1})`;
500
- },
501
- HEX: () => u(h.hex).alpha(r.alpha ?? 1).hex(),
502
- HSL: () => {
503
- var f;
504
- return `hsla(${Math.floor(h.hsl[0])}, ${Math.floor(
505
- h.hsl[1] * 100
506
- )}% ${Math.floor(h.hsl[2] * 100)}% ${((f = r.alpha) == null ? void 0 : f.toFixed(2)) ?? 1})`;
507
- },
508
- LCH: () => {
509
- var f;
510
- return `lch(${Math.floor(h.lch[0])}% ${Math.floor(
511
- h.lch[1]
512
- )} ${Math.floor(h.lch[2])} / ${((f = r.alpha) == null ? void 0 : f.toFixed(2)) ?? 1})`;
513
- },
514
- OKLCH: () => {
515
- var f;
516
- return `oklch(${Math.floor(h.oklch[0] * 100)}% ${h.oklch[1].toFixed(3)} ${Math.floor(h.oklch[2])} / ${((f = r.alpha) == null ? void 0 : f.toFixed(2)) ?? 1})`;
517
- }
518
- };
519
- return (p = s[l ?? "RGB"]) == null ? void 0 : p.call(s);
520
- }, e = n.find(
521
- (r) => r.type === "default theme"
522
- );
523
- if (e) {
524
- const r = [];
525
- return e.colors.forEach((h, s) => {
526
- s > 0 && r.push(""), r.push(`// ${h.name}`), h.shades.reverse().forEach((p) => {
527
- const f = h.shades.find((g) => g.type === "source color"), $ = `@${new b(h.name).doKebabCase()}-${p.name}`;
528
- f && r.push(
529
- `${$}: ${p.isTransparent ? a(p, f) : i(p)};`
530
- );
531
- });
532
- }), t.push(r.join(`
533
- `)), t.join(`
534
- `);
535
- }
536
- n.forEach((r) => {
537
- const h = new b(r.name).doKebabCase(), s = [];
538
- s.push(`// ${r.name}`), s.push(`.${h}() {`), r.colors.forEach((p, f) => {
539
- f > 0 && s.push(""), s.push(` // ${p.name}`), p.shades.reverse().forEach(($) => {
540
- const g = p.shades.find((C) => C.type === "source color"), d = `@${new b(p.name).doKebabCase()}-${$.name}`;
541
- g && s.push(
542
- ` ${d}: ${$.isTransparent ? a($, g) : i($)};`
543
- );
544
- });
545
- }), s.push("}"), t.push(s.join(`
546
- `));
547
- });
548
- const o = [":root {"];
549
- n.forEach((r, h) => {
550
- const s = new b(r.name).doKebabCase();
551
- o.push(` &[data-theme="${s}"] {
552
- .${s}();
553
- }`), h !== n.length - 1 && o.push("");
554
- }), o.push("}"), t.push(o.join(`
555
- `));
556
- const c = [];
557
- return n.forEach((r) => {
558
- const h = new b(r.name).doKebabCase();
559
- c.push(`.${h} {
560
- .${h}();
561
- }`);
562
- }), t.push(c.join(`
563
-
564
- `)), t.join(`
565
-
566
- `);
567
- }, G = (m, l) => {
568
- const n = m.themes.filter((e) => e.type === "custom theme").length === 0 ? m.themes.filter((e) => e.type === "default theme") : m.themes.filter((e) => e.type === "custom theme"), t = {}, i = (e) => {
569
- var c;
570
- isNaN(e.oklch[2]) && (e.oklch[2] = 0);
571
- const o = {
572
- RGB: () => ({
573
- colorSpace: "srgb",
574
- components: [
575
- parseFloat(e.gl[0].toFixed(3)),
576
- parseFloat(e.gl[1].toFixed(3)),
577
- parseFloat(e.gl[2].toFixed(3))
578
- ],
579
- hex: e.hex
580
- }),
581
- OKLCH: () => ({
582
- colorSpace: "oklch",
583
- components: [
584
- parseFloat(e.oklch[0].toFixed(3)),
585
- parseFloat(e.oklch[1].toFixed(3)),
586
- parseFloat(e.oklch[2].toFixed(0))
587
- ],
588
- hex: e.hex
589
- })
590
- };
591
- return (c = o[l ?? "RGB"]) == null ? void 0 : c.call(o);
592
- }, a = (e, o) => {
593
- var r;
594
- isNaN(o.oklch[2]) && (o.oklch[2] = 0);
595
- const c = {
596
- RGB: () => ({
597
- colorSpace: "srgb",
598
- components: [
599
- parseFloat(e.gl[0].toFixed(3)),
600
- parseFloat(e.gl[1].toFixed(3)),
601
- parseFloat(e.gl[2].toFixed(3))
602
- ],
603
- hex: e.hex,
604
- alpha: o.alpha
605
- }),
606
- OKLCH: () => ({
607
- colorSpace: "oklch",
608
- components: [
609
- parseFloat(e.oklch[0].toFixed(3)),
610
- parseFloat(e.oklch[1].toFixed(3)),
611
- parseFloat(e.oklch[2].toFixed(0))
612
- ],
613
- hex: e.hex,
614
- alpha: o.alpha
615
- })
616
- };
617
- return (r = c[l ?? "RGB"]) == null ? void 0 : r.call(c);
618
- };
619
- return n[0].type === "custom theme" ? n.forEach((e) => {
620
- e.colors.forEach((o) => {
621
- const c = o.shades.find(
622
- (r) => r.type === "source color"
623
- );
624
- t[o.name] || (t[o.name] = {
625
- $type: "color"
626
- }), o.shades.forEach((r) => {
627
- !t[o.name][r.name] && c && (t[o.name][r.name] = {
628
- $type: "color",
629
- $value: r.isTransparent ? a(c, r) : i(r),
630
- $description: o.description !== "" ? o.description + " - " + r.description : r.description,
631
- $extensions: {
632
- mode: {}
633
- }
634
- }), c && (t[o.name][r.name].$extensions.mode[e.name] = r.isTransparent ? a(c, r) : i(r));
635
- });
636
- });
637
- }) : n.forEach((e) => {
638
- e.colors.forEach((o) => {
639
- const c = o.shades.find(
640
- (r) => r.type === "source color"
641
- );
642
- t[o.name] = {}, o.shades.forEach((r) => {
643
- r && c && (t[o.name][r.name] = {
644
- $type: "color",
645
- $value: r.isTransparent ? a(c, r) : i(r),
646
- $description: o.description !== "" ? o.description + " - " + r.description : r.description
647
- });
648
- });
649
- });
650
- }), JSON.stringify(t, null, " ");
651
- }, O = (m) => {
652
- const l = m.themes.filter((c) => c.type === "custom theme").length === 0 ? m.themes.filter((c) => c.type === "default theme") : m.themes.filter((c) => c.type === "custom theme"), n = [], t = [], i = [], a = [], e = [], o = [];
653
- return l.forEach((c) => {
654
- c.colors.forEach((r) => {
655
- r.shades.forEach((h) => {
656
- i.push(h.name), a.push(Math.floor(h.lch[0])), e.push(Math.floor(h.lch[1])), o.push(Math.floor(h.lch[2]));
657
- }), n.push({
658
- name: r.name,
659
- csv: `${r.name},Lightness,Chroma,Hue
660
- ${i.map((h, s) => `${h},${a[s]},${e[s]},${o[s]}`).join(`
661
- `)}`
662
- }), i.splice(0, i.length), a.splice(0, a.length), e.splice(0, e.length), o.splice(0, o.length);
663
- }), t.push({
664
- name: c.name,
665
- colors: n.map((r) => r),
666
- type: c.type
667
- }), n.splice(0, n.length);
668
- }), t;
669
- }, _ = (m, l) => {
670
- const n = m.themes.filter((e) => e.type === "custom theme").length === 0 ? m.themes.filter((e) => e.type === "default theme") : m.themes.filter((e) => e.type === "custom theme"), t = [], i = (e) => {
671
- var c;
672
- isNaN(e.hsl[0]) && (e.hsl[0] = 0), isNaN(e.lch[2]) && (e.lch[2] = 0), isNaN(e.oklch[2]) && (e.oklch[2] = 0);
673
- const o = {
674
- RGB: () => `rgb(${Math.floor(e.rgb[0])}, ${Math.floor(
675
- e.rgb[1]
676
- )}, ${Math.floor(e.rgb[2])})`,
677
- HEX: () => e.hex,
678
- HSL: () => `hsl(${Math.floor(e.hsl[0])} ${Math.floor(
679
- e.hsl[1] * 100
680
- )}% ${Math.floor(e.hsl[2] * 100)}%)`,
681
- LCH: () => `lch(${Math.floor(e.lch[0])}% ${Math.floor(
682
- e.lch[1]
683
- )} ${Math.floor(e.lch[2])})`,
684
- OKLCH: () => `oklch(${Math.floor(e.oklch[0] * 100)}% ${e.oklch[1].toFixed(3)} ${Math.floor(e.oklch[2])})`,
685
- P3: () => `color(display-p3 ${e.gl[0].toFixed(3)} ${e.gl[1].toFixed(
686
- 3
687
- )} ${e.gl[2].toFixed(3)})`
688
- };
689
- return (c = o[l ?? "RGB"]) == null ? void 0 : c.call(o);
690
- }, a = (e, o) => {
691
- var r;
692
- isNaN(e.hsl[0]) && (e.hsl[0] = 0), isNaN(e.lch[2]) && (e.lch[2] = 0), isNaN(e.oklch[2]) && (e.oklch[2] = 0);
693
- const c = {
694
- RGB: () => {
695
- var h;
696
- return `rgb(${Math.floor(o.rgb[0])}, ${Math.floor(
697
- o.rgb[1]
698
- )}, ${Math.floor(o.rgb[2])} / ${((h = e.alpha) == null ? void 0 : h.toFixed(2)) ?? 1})`;
699
- },
700
- HEX: () => u(o.hex).alpha(e.alpha ?? 1).hex(),
701
- HSL: () => {
702
- var h;
703
- return `hsl(${Math.floor(o.hsl[0])} ${Math.floor(
704
- o.hsl[1] * 100
705
- )}% ${Math.floor(o.hsl[2] * 100)}% / ${((h = e.alpha) == null ? void 0 : h.toFixed(2)) ?? 1})`;
706
- },
707
- LCH: () => {
708
- var h;
709
- return `lch(${Math.floor(o.lch[0])}% ${Math.floor(
710
- o.lch[1]
711
- )} ${Math.floor(o.lch[2])} / ${((h = e.alpha) == null ? void 0 : h.toFixed(2)) ?? 1})`;
712
- },
713
- OKLCH: () => {
714
- var h;
715
- return `oklch(${Math.floor(o.oklch[0 * 100])}% ${o.oklch[1].toFixed(3)} ${Math.floor(o.oklch[2])} / ${((h = e.alpha) == null ? void 0 : h.toFixed(2)) ?? 1})`;
716
- },
717
- P3: () => {
718
- var h;
719
- return `color(display-p3 ${o.gl[0].toFixed(3)} ${o.gl[1].toFixed(
720
- 3
721
- )} ${o.gl[2].toFixed(3)} / ${((h = e.alpha) == null ? void 0 : h.toFixed(2)) ?? 1})`;
722
- }
723
- };
724
- return (r = c[l ?? "RGB"]) == null ? void 0 : r.call(c);
725
- };
726
- return n.forEach((e) => {
727
- const o = [];
728
- e.colors.forEach((c) => {
729
- o.push(`/* ${c.name} */`), c.shades.reverse().forEach((r) => {
730
- const h = c.shades.find((s) => s.type === "source color");
731
- h && o.push(
732
- `--${new b(c.name).doKebabCase()}-${r.name}: ${r.isTransparent ? a(r, h) : i(r)};`
733
- );
734
- }), o.push("");
735
- }), o.pop(), t.push(
736
- `${e.type === "custom theme" ? `/* ${e.name} */
737
- ` : ""}:root${e.type === "custom theme" ? `[data-theme='${new b(e.name).doKebabCase()}']` : ""} {
738
- ${o.join(`
739
- `)}
740
- }`
741
- );
742
- }), t.join(`
743
-
744
- `);
745
- }, U = (m) => {
746
- const l = m.themes.filter((t) => t.type === "custom theme").length === 0 ? m.themes.filter((t) => t.type === "default theme") : m.themes.filter((t) => t.type === "custom theme"), n = [];
747
- return l.forEach((t) => {
748
- t.colors.forEach((i) => {
749
- const a = i.shades.find((o) => o.type === "source color"), e = [];
750
- e.push(
751
- `// ${l[0].type === "custom theme" ? t.name + " - " : ""}${i.name}`
752
- ), i.shades.reverse().forEach((o) => {
753
- e.push(
754
- `val ${l[0].type === "custom theme" ? new b(t.name + " " + i.name).doSnakeCase() : new b(i.name).doSnakeCase()}_${o.name} = Color(${o.isTransparent ? u((a == null ? void 0 : a.hex) ?? "#000000").alpha(o.alpha ?? 1).hex().replace("#", "0xFF").toUpperCase() : o.hex.replace("#", "0xFF").toUpperCase()})`
755
- );
756
- }), e.push(""), e.forEach((o) => n.push(o));
757
- });
758
- }), n.pop(), `import androidx.compose.ui.graphics.Color
759
-
760
- ${n.join(`
761
- `)}`;
762
- };
763
- class J {
1
+ var v = Object.defineProperty;
2
+ var E = (m, a, h) => a in m ? v(m, a, { enumerable: !0, configurable: !0, writable: !0, value: h }) : m[a] = h;
3
+ var d = (m, a, h) => E(m, typeof a != "symbol" ? a + "" : a, h);
4
+ import { C as S, H as f } from "../../color-1CXTuV84.js";
5
+ import { c as t } from "../../index-Beb8qoyd.js";
6
+ class A {
764
7
  constructor({
765
- base: l,
766
- themes: n,
767
- meta: t
8
+ base: a,
9
+ themes: h,
10
+ meta: r
768
11
  }) {
769
- k(this, "base");
770
- k(this, "themes");
771
- k(this, "meta");
772
- k(this, "paletteData");
773
- k(this, "currentScale");
774
- k(this, "makePaletteData", () => (this.themes.forEach((l) => {
775
- const n = {
776
- id: l.id,
777
- name: l.name,
778
- description: l.description,
12
+ d(this, "base");
13
+ d(this, "themes");
14
+ d(this, "meta");
15
+ d(this, "paletteData");
16
+ d(this, "currentScale");
17
+ d(this, "makePaletteData", () => (this.themes.forEach((a) => {
18
+ const h = {
19
+ id: a.id,
20
+ name: a.name,
21
+ description: a.description,
779
22
  colors: [],
780
- type: l.type
23
+ type: a.type
781
24
  };
782
- this.base.colors.forEach((t) => {
783
- const i = Object.entries(l.scale).reverse().map((h) => {
784
- if (t.alpha.isEnabled) {
785
- const s = new x({
25
+ this.base.colors.forEach((r) => {
26
+ const g = Object.entries(a.scale).reverse().map((e) => {
27
+ if (r.alpha.isEnabled) {
28
+ const s = new S({
786
29
  render: "RGB",
787
30
  sourceColor: [
788
- t.rgb.r * 255,
789
- t.rgb.g * 255,
790
- t.rgb.b * 255
31
+ r.rgb.r * 255,
32
+ r.rgb.g * 255,
33
+ r.rgb.b * 255
791
34
  ],
792
- alpha: parseFloat((h[1] / 100).toFixed(2)),
793
- hueShifting: t.hue.shift !== void 0 ? t.hue.shift : 0,
794
- chromaShifting: t.chroma.shift !== void 0 ? t.chroma.shift : 100,
35
+ alpha: parseFloat((e[1] / 100).toFixed(2)),
36
+ hueShifting: r.hue.shift !== void 0 ? r.hue.shift : 0,
37
+ chromaShifting: r.chroma.shift !== void 0 ? r.chroma.shift : 100,
795
38
  algorithmVersion: this.base.algorithmVersion,
796
- visionSimulationMode: l.visionSimulationMode
797
- }), p = new x({
39
+ visionSimulationMode: a.visionSimulationMode
40
+ }), b = new S({
798
41
  render: "RGB",
799
- sourceColor: u(t.alpha.backgroundColor).rgb(),
42
+ sourceColor: t(r.alpha.backgroundColor).rgb(),
800
43
  algorithmVersion: this.base.algorithmVersion,
801
- visionSimulationMode: l.visionSimulationMode
44
+ visionSimulationMode: a.visionSimulationMode
802
45
  });
803
46
  switch (this.base.colorSpace) {
804
47
  case "LCH":
805
48
  return this.base.areSourceColorsLocked ? [
806
- h,
49
+ e,
807
50
  s.setColorWithAlpha(),
808
- p.setColorWithAlpha()
51
+ b.setColorWithAlpha()
809
52
  ] : [
810
- h,
53
+ e,
811
54
  s.lcha(),
812
- p.lcha()
55
+ b.lcha()
813
56
  ];
814
57
  case "OKLCH":
815
58
  return this.base.areSourceColorsLocked ? [
816
- h,
59
+ e,
817
60
  s.setColorWithAlpha(),
818
- p.setColorWithAlpha()
61
+ b.setColorWithAlpha()
819
62
  ] : [
820
- h,
63
+ e,
821
64
  s.oklcha(),
822
- p.oklcha()
65
+ b.oklcha()
823
66
  ];
824
67
  case "LAB":
825
68
  return this.base.areSourceColorsLocked ? [
826
- h,
69
+ e,
827
70
  s.setColorWithAlpha(),
828
- p.setColorWithAlpha()
71
+ b.setColorWithAlpha()
829
72
  ] : [
830
- h,
73
+ e,
831
74
  s.laba(),
832
- p.laba()
75
+ b.laba()
833
76
  ];
834
77
  case "OKLAB":
835
78
  return this.base.areSourceColorsLocked ? [
836
- h,
79
+ e,
837
80
  s.setColorWithAlpha(),
838
- p.setColorWithAlpha()
81
+ b.setColorWithAlpha()
839
82
  ] : [
840
- h,
83
+ e,
841
84
  s.oklaba(),
842
- p.oklaba()
85
+ b.oklaba()
843
86
  ];
844
87
  case "HSL":
845
88
  return this.base.areSourceColorsLocked ? [
846
- h,
89
+ e,
847
90
  s.setColorWithAlpha(),
848
- p.setColorWithAlpha()
91
+ b.setColorWithAlpha()
849
92
  ] : [
850
- h,
93
+ e,
851
94
  s.hsla(),
852
- p.hsla()
95
+ b.hsla()
853
96
  ];
854
97
  case "HSLUV":
855
98
  return this.base.areSourceColorsLocked ? [
856
- h,
99
+ e,
857
100
  s.setColorWithAlpha(),
858
- p.setColorWithAlpha()
101
+ b.setColorWithAlpha()
859
102
  ] : [
860
- h,
103
+ e,
861
104
  s.hsluva(),
862
- p.hsluva()
105
+ b.hsluva()
863
106
  ];
864
107
  default:
865
- return [h, [0, 0, 0], [255, 255, 255]];
108
+ return [e, [0, 0, 0], [255, 255, 255]];
866
109
  }
867
110
  } else {
868
- const s = new x({
111
+ const s = new S({
869
112
  render: "RGB",
870
113
  sourceColor: [
871
- t.rgb.r * 255,
872
- t.rgb.g * 255,
873
- t.rgb.b * 255
114
+ r.rgb.r * 255,
115
+ r.rgb.g * 255,
116
+ r.rgb.b * 255
874
117
  ],
875
- lightness: h[1],
876
- hueShifting: t.hue.shift !== void 0 ? t.hue.shift : 0,
877
- chromaShifting: t.chroma.shift !== void 0 ? t.chroma.shift : 100,
118
+ lightness: e[1],
119
+ hueShifting: r.hue.shift !== void 0 ? r.hue.shift : 0,
120
+ chromaShifting: r.chroma.shift !== void 0 ? r.chroma.shift : 100,
878
121
  algorithmVersion: this.base.algorithmVersion,
879
- visionSimulationMode: l.visionSimulationMode
122
+ visionSimulationMode: a.visionSimulationMode
880
123
  });
881
124
  switch (this.base.colorSpace) {
882
125
  case "LCH":
883
- return [h, s.lch()];
126
+ return [e, s.lch()];
884
127
  case "OKLCH":
885
- return [h, s.oklch()];
128
+ return [e, s.oklch()];
886
129
  case "LAB":
887
- return [h, s.lab()];
130
+ return [e, s.lab()];
888
131
  case "OKLAB":
889
- return [h, s.oklab()];
132
+ return [e, s.oklab()];
890
133
  case "HSL":
891
- return [h, s.hsl()];
134
+ return [e, s.hsl()];
892
135
  case "HSLUV":
893
- return [h, s.hsluv()];
136
+ return [e, s.hsluv()];
894
137
  default:
895
- return [h, [0, 0, 0]];
138
+ return [e, [0, 0, 0]];
896
139
  }
897
140
  }
898
- }), a = {
899
- id: t.id,
900
- name: t.name,
901
- description: t.description,
141
+ }), u = {
142
+ id: r.id,
143
+ name: r.name,
144
+ description: r.description,
902
145
  shades: [],
903
146
  type: "color"
904
- }, e = [
905
- t.rgb.r * 255,
906
- t.rgb.g * 255,
907
- t.rgb.b * 255
908
- ], o = new M();
909
- o.rgb_r = t.rgb.r, o.rgb_g = t.rgb.g, o.rgb_b = t.rgb.b, o.rgbToHsluv(), a.shades.push({
147
+ }, i = [
148
+ r.rgb.r * 255,
149
+ r.rgb.g * 255,
150
+ r.rgb.b * 255
151
+ ], c = new f();
152
+ c.rgb_r = r.rgb.r, c.rgb_g = r.rgb.g, c.rgb_b = r.rgb.b, c.rgbToHsluv(), u.shades.push({
910
153
  name: "source",
911
154
  description: "Source color",
912
- hex: u(e).hex(),
913
- rgb: e,
914
- gl: u(e).gl(),
915
- lch: u(e).lch(),
916
- oklch: u(e).oklch(),
917
- lab: u(e).lab(),
918
- oklab: u(e).oklab(),
919
- hsl: u(e).hsl(),
155
+ hex: t(i).hex(),
156
+ rgb: i,
157
+ gl: t(i).gl(),
158
+ lch: t(i).lch(),
159
+ oklch: t(i).oklch(),
160
+ lab: t(i).lab(),
161
+ oklab: t(i).oklab(),
162
+ hsl: t(i).hsl(),
920
163
  hsluv: [
921
- o.hsluv_h,
922
- o.hsluv_s,
923
- o.hsluv_l
164
+ c.hsluv_h,
165
+ c.hsluv_s,
166
+ c.hsluv_l
924
167
  ],
925
168
  type: "source color"
926
169
  });
927
- const c = i.map(
928
- (h) => u.distance(
929
- u(e).hex(),
930
- u(h[1]).hex(),
170
+ const k = g.map(
171
+ (e) => t.distance(
172
+ t(i).hex(),
173
+ t(e[1]).hex(),
931
174
  "rgb"
932
175
  )
933
- ), r = c.indexOf(Math.min(...c));
934
- i.forEach((h, s) => {
935
- const p = u.distance(
936
- u(e).hex(),
937
- u(h[1]).hex(),
176
+ ), l = k.indexOf(Math.min(...k));
177
+ g.forEach((e, s) => {
178
+ const b = t.distance(
179
+ t(i).hex(),
180
+ t(e[1]).hex(),
938
181
  "rgb"
939
- ), f = Object.keys(this.currentScale).find(
940
- (C) => C === h[0][0]
941
- ) ?? "0", $ = new M(), g = new x({
182
+ ), L = Object.keys(this.currentScale).find(
183
+ (p) => p === e[0][0]
184
+ ) ?? "0", o = new f(), C = new S({
942
185
  render: "RGB",
943
- sourceColor: u(e).rgb(),
944
- visionSimulationMode: l.visionSimulationMode
945
- }).setColor(), d = new x({
186
+ sourceColor: t(i).rgb(),
187
+ visionSimulationMode: a.visionSimulationMode
188
+ }).setColor(), n = new S({
946
189
  render: "HEX",
947
- sourceColor: u(e).rgb(),
948
- visionSimulationMode: l.visionSimulationMode
190
+ sourceColor: t(i).rgb(),
191
+ visionSimulationMode: a.visionSimulationMode
949
192
  }).setColor();
950
- s === r && this.base.areSourceColorsLocked && !t.alpha.isEnabled ? ($.rgb_r = Number(g[0]) / 255, $.rgb_g = Number(g[1]) / 255, $.rgb_b = Number(g[2]) / 255) : ($.rgb_r = Number(h[1][0]) / 255, $.rgb_g = Number(h[1][1]) / 255, $.rgb_b = Number(h[1][2]) / 255), $.rgbToHsluv(), a.shades.push({
951
- name: f,
952
- description: `Shade/Tint color with ${typeof h[0][1] == "number" ? h[0][1].toFixed(1) : h[0][1]}% of ${t.alpha.isEnabled ? "opacity" : "lightness"}`,
953
- hex: s === r && this.base.areSourceColorsLocked && !t.alpha.isEnabled ? u(d).hex() : u(h[1]).hex(),
954
- rgb: s === r && this.base.areSourceColorsLocked && !t.alpha.isEnabled ? u(d).rgb() : u(h[1]).rgb(),
955
- gl: s === r && this.base.areSourceColorsLocked && !t.alpha.isEnabled ? u(d).gl() : u(h[1]).gl(),
956
- lch: s === r && this.base.areSourceColorsLocked && !t.alpha.isEnabled ? u(d).lch() : u(h[1]).lch(),
957
- oklch: s === r && this.base.areSourceColorsLocked && !t.alpha.isEnabled ? u(d).oklch() : u(h[1]).oklch(),
958
- lab: s === r && this.base.areSourceColorsLocked && !t.alpha.isEnabled ? u(d).lab() : u(h[1]).lab(),
959
- oklab: s === r && this.base.areSourceColorsLocked && !t.alpha.isEnabled ? u(d).oklab() : u(h[1]).oklab(),
960
- hsl: s === r && this.base.areSourceColorsLocked && !t.alpha.isEnabled ? u(d).hsl() : u(h[1]).hsl(),
961
- hsluv: [$.hsluv_h, $.hsluv_s, $.hsluv_l],
962
- alpha: t.alpha.isEnabled ? parseFloat((h[0][1] / 100).toFixed(2)) : void 0,
963
- backgroundColor: t.alpha.isEnabled && t.alpha.backgroundColor ? u(h[2]).rgb() : void 0,
964
- mixedColor: t.alpha.isEnabled && t.alpha.backgroundColor ? new x({
965
- visionSimulationMode: l.visionSimulationMode
193
+ s === l && this.base.areSourceColorsLocked && !r.alpha.isEnabled ? (o.rgb_r = Number(C[0]) / 255, o.rgb_g = Number(C[1]) / 255, o.rgb_b = Number(C[2]) / 255) : (o.rgb_r = Number(e[1][0]) / 255, o.rgb_g = Number(e[1][1]) / 255, o.rgb_b = Number(e[1][2]) / 255), o.rgbToHsluv(), u.shades.push({
194
+ name: L,
195
+ description: `Shade/Tint color with ${typeof e[0][1] == "number" ? e[0][1].toFixed(1) : e[0][1]}% of ${r.alpha.isEnabled ? "opacity" : "lightness"}`,
196
+ hex: s === l && this.base.areSourceColorsLocked && !r.alpha.isEnabled ? t(n).hex() : t(e[1]).hex(),
197
+ rgb: s === l && this.base.areSourceColorsLocked && !r.alpha.isEnabled ? t(n).rgb() : t(e[1]).rgb(),
198
+ gl: s === l && this.base.areSourceColorsLocked && !r.alpha.isEnabled ? t(n).gl() : t(e[1]).gl(),
199
+ lch: s === l && this.base.areSourceColorsLocked && !r.alpha.isEnabled ? t(n).lch() : t(e[1]).lch(),
200
+ oklch: s === l && this.base.areSourceColorsLocked && !r.alpha.isEnabled ? t(n).oklch() : t(e[1]).oklch(),
201
+ lab: s === l && this.base.areSourceColorsLocked && !r.alpha.isEnabled ? t(n).lab() : t(e[1]).lab(),
202
+ oklab: s === l && this.base.areSourceColorsLocked && !r.alpha.isEnabled ? t(n).oklab() : t(e[1]).oklab(),
203
+ hsl: s === l && this.base.areSourceColorsLocked && !r.alpha.isEnabled ? t(n).hsl() : t(e[1]).hsl(),
204
+ hsluv: [o.hsluv_h, o.hsluv_s, o.hsluv_l],
205
+ alpha: r.alpha.isEnabled ? parseFloat((e[0][1] / 100).toFixed(2)) : void 0,
206
+ backgroundColor: r.alpha.isEnabled && r.alpha.backgroundColor ? t(e[2]).rgb() : void 0,
207
+ mixedColor: r.alpha.isEnabled && r.alpha.backgroundColor ? new S({
208
+ visionSimulationMode: a.visionSimulationMode
966
209
  }).mixColorsRgb(
967
210
  [
968
- ...h[1],
211
+ ...e[1],
969
212
  parseFloat(
970
- (h[0][1] / 100).toFixed(2)
213
+ (e[0][1] / 100).toFixed(2)
971
214
  )
972
215
  ],
973
- [...h[2], 1]
216
+ [...e[2], 1]
974
217
  ) : void 0,
975
- isClosestToRef: p < 4 && !this.base.areSourceColorsLocked,
976
- isSourceColorLocked: s === r && this.base.areSourceColorsLocked && !t.alpha.isEnabled,
977
- isTransparent: t.alpha.isEnabled,
218
+ isClosestToRef: b < 4 && !this.base.areSourceColorsLocked,
219
+ isSourceColorLocked: s === l && this.base.areSourceColorsLocked && !r.alpha.isEnabled,
220
+ isTransparent: r.alpha.isEnabled,
978
221
  type: "color shade/tint"
979
222
  });
980
- }), n.colors.push(a);
981
- }), this.paletteData.themes.push(n);
223
+ }), h.colors.push(u);
224
+ }), this.paletteData.themes.push(h);
982
225
  }), this.paletteData));
983
- k(this, "makeLibraryData", (l, n) => {
984
- const t = this.makePaletteData();
985
- return t.themes.flatMap(
986
- (a) => a.colors.flatMap(
987
- (e) => e.shades.flatMap((o) => {
988
- const c = `${a.id}:${e.id}:${o.name}`, r = n == null ? void 0 : n.find(
989
- (h) => h.id === c
226
+ d(this, "makeLibraryData", (a, h) => {
227
+ const r = this.makePaletteData();
228
+ return r.themes.flatMap(
229
+ (u) => u.colors.flatMap(
230
+ (i) => i.shades.flatMap((c) => {
231
+ const k = `${u.id}:${i.id}:${c.name}`, l = h == null ? void 0 : h.find(
232
+ (e) => e.id === k
990
233
  );
991
234
  return {
992
- id: c,
993
- paletteName: t.name,
994
- themeName: a.name,
995
- colorName: e.name,
996
- shadeName: o.name,
997
- ...(l == null ? void 0 : l.includes("alpha")) && { alpha: o.alpha ?? 1 },
998
- ...(l == null ? void 0 : l.includes("hex")) && { hex: o.hex },
999
- ...(l == null ? void 0 : l.includes("gl")) && { gl: o.gl },
1000
- ...(l == null ? void 0 : l.includes("description")) && {
1001
- description: e.description
235
+ id: k,
236
+ paletteName: r.name,
237
+ themeName: u.name,
238
+ colorName: i.name,
239
+ shadeName: c.name,
240
+ ...(a == null ? void 0 : a.includes("alpha")) && { alpha: c.alpha ?? 1 },
241
+ ...(a == null ? void 0 : a.includes("hex")) && { hex: c.hex },
242
+ ...(a == null ? void 0 : a.includes("gl")) && { gl: c.gl },
243
+ ...(a == null ? void 0 : a.includes("description")) && {
244
+ description: i.description
1002
245
  },
1003
- ...(l == null ? void 0 : l.includes("collection_id")) && {
1004
- collectionId: r == null ? void 0 : r.collectionId
246
+ ...(a == null ? void 0 : a.includes("collection_id")) && {
247
+ collectionId: l == null ? void 0 : l.collectionId
1005
248
  },
1006
- ...(l == null ? void 0 : l.includes("mode_id")) && {
1007
- modeId: r == null ? void 0 : r.modeId
249
+ ...(a == null ? void 0 : a.includes("mode_id")) && {
250
+ modeId: l == null ? void 0 : l.modeId
1008
251
  },
1009
- ...(l == null ? void 0 : l.includes("variable_id")) && {
1010
- variableId: r == null ? void 0 : r.variableId
252
+ ...(a == null ? void 0 : a.includes("variable_id")) && {
253
+ variableId: l == null ? void 0 : l.variableId
1011
254
  },
1012
- ...(l == null ? void 0 : l.includes("style_id")) && {
1013
- styleId: r == null ? void 0 : r.styleId
255
+ ...(a == null ? void 0 : a.includes("style_id")) && {
256
+ styleId: l == null ? void 0 : l.styleId
1014
257
  }
1015
258
  };
1016
259
  })
1017
260
  )
1018
261
  );
1019
262
  });
1020
- k(this, "makeNativeTokens", () => {
1021
- const l = this.makePaletteData();
1022
- return B(l);
1023
- });
1024
- k(this, "makeDtcgTokens", (l = "RGB") => {
1025
- const n = this.makePaletteData();
1026
- return G(n, l);
1027
- });
1028
- k(this, "makeStyleDictionaryV3Tokens", () => {
1029
- const l = this.makePaletteData();
1030
- return V(l);
1031
- });
1032
- k(this, "makeUniversalJson", () => {
1033
- const l = this.makePaletteData();
1034
- return S(l);
1035
- });
1036
- k(this, "makeCssCustomProps", (l = "RGB") => {
1037
- const n = this.makePaletteData();
1038
- return _(n, l);
1039
- });
1040
- k(this, "makeScssVariables", (l = "RGB") => {
1041
- const n = this.makePaletteData();
1042
- return P(n, l);
1043
- });
1044
- k(this, "makeLessVariables", (l = "RGB") => {
1045
- const n = this.makePaletteData();
1046
- return R(n, l);
1047
- });
1048
- k(this, "makeTailwindV3Config", () => {
1049
- const l = this.makePaletteData();
1050
- return K(l);
1051
- });
1052
- k(this, "makeTailwindV4Config", () => {
1053
- const l = this.makePaletteData();
1054
- return H(l);
1055
- });
1056
- k(this, "makeSwiftUI", () => {
1057
- const l = this.makePaletteData();
1058
- return A(l);
1059
- });
1060
- k(this, "makeUIKit", () => {
1061
- const l = this.makePaletteData();
1062
- return L(l);
1063
- });
1064
- k(this, "makeCompose", () => {
1065
- const l = this.makePaletteData();
1066
- return U(l);
1067
- });
1068
- k(this, "makeResources", () => {
1069
- const l = this.makePaletteData();
1070
- return j(l);
1071
- });
1072
- k(this, "makeCsv", () => {
1073
- const l = this.makePaletteData();
1074
- return O(l);
1075
- });
1076
- k(this, "makePaletteFullData", () => ({
263
+ d(this, "makePaletteFullData", () => ({
1077
264
  base: this.base,
1078
265
  themes: this.themes,
1079
266
  libraryData: this.makeLibraryData(),
@@ -1081,16 +268,16 @@ class J {
1081
268
  version: "2025.06",
1082
269
  type: "UI_COLOR_PALETTE"
1083
270
  }));
1084
- var i;
1085
- this.base = l, this.themes = n, this.meta = t, this.paletteData = {
1086
- name: l.name ?? "UI Color Palette",
1087
- description: l.description,
271
+ var g;
272
+ this.base = a, this.themes = h, this.meta = r, this.paletteData = {
273
+ name: a.name ?? "UI Color Palette",
274
+ description: a.description,
1088
275
  themes: [],
1089
276
  type: "palette"
1090
- }, this.currentScale = ((i = n.find((a) => a.isEnabled)) == null ? void 0 : i.scale) ?? {};
277
+ }, this.currentScale = ((g = h.find((u) => u.isEnabled)) == null ? void 0 : g.scale) ?? {};
1091
278
  }
1092
279
  }
1093
280
  export {
1094
- J as default
281
+ A as default
1095
282
  };
1096
283
  //# sourceMappingURL=data.js.map