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