@a_ng_d/utils-ui-color-palette 1.6.0 → 1.6.2

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,28 +1,786 @@
1
- var i = Object.defineProperty;
2
- var r = (t, a, s) => a in t ? i(t, a, { enumerable: !0, configurable: !0, writable: !0, value: s }) : t[a] = s;
3
- var e = (t, a, s) => r(t, typeof a != "symbol" ? a + "" : a, s);
4
- import { m as k, a as n, b as m, c as l, d as o, e as p, f as u, g as D, h, i as C, j as c, k as T, l as V, n as f } from "../../makeCompose-hjSTxNaX.js";
5
- class v {
6
- constructor(a) {
7
- e(this, "paletteData");
8
- e(this, "makeNativeTokens", () => k(this.paletteData));
9
- e(this, "makeDtcgTokens", (a = "RGB") => n(this.paletteData, a));
10
- e(this, "makeStyleDictionaryV3Tokens", () => m(this.paletteData));
11
- e(this, "makeUniversalJson", () => l(this.paletteData));
12
- e(this, "makeCssCustomProps", (a = "RGB") => o(this.paletteData, a));
13
- e(this, "makeScssVariables", (a = "RGB") => p(this.paletteData, a));
14
- e(this, "makeLessVariables", (a = "RGB") => u(this.paletteData, a));
15
- e(this, "makeTailwindV3Config", () => D(this.paletteData));
16
- e(this, "makeTailwindV4Config", () => h(this.paletteData));
17
- e(this, "makeSwiftUI", () => C(this.paletteData));
18
- e(this, "makeUIKit", () => c(this.paletteData));
19
- e(this, "makeCompose", () => T(this.paletteData));
20
- e(this, "makeResources", () => V(this.paletteData));
21
- e(this, "makeCsv", () => f(this.paletteData));
22
- this.paletteData = a;
1
+ var E = Object.defineProperty;
2
+ var N = (c, h, a) => h in c ? E(c, h, { enumerable: !0, configurable: !0, writable: !0, value: a }) : c[h] = a;
3
+ var b = (c, h, a) => N(c, typeof h != "symbol" ? h + "" : h, a);
4
+ import { c as k } from "../../index-Beb8qoyd.js";
5
+ const w = (c) => {
6
+ const h = 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"), a = {}, n = (o) => (isNaN(o.hsl[0]) && (o.hsl[0] = 0), isNaN(o.lch[2]) && (o.lch[2] = 0), isNaN(o.oklch[2]) && (o.oklch[2] = 0), {
7
+ rgb: {
8
+ r: Math.floor(o.rgb[0]),
9
+ g: Math.floor(o.rgb[1]),
10
+ b: Math.floor(o.rgb[2])
11
+ },
12
+ gl: {
13
+ r: parseFloat(o.gl[0].toFixed(3)),
14
+ g: parseFloat(o.gl[1].toFixed(3)),
15
+ b: parseFloat(o.gl[2].toFixed(3))
16
+ },
17
+ lch: {
18
+ l: Math.floor(o.lch[0]),
19
+ c: Math.floor(o.lch[1]),
20
+ h: Math.floor(o.lch[2])
21
+ },
22
+ oklch: {
23
+ l: parseFloat(o.oklch[0].toFixed(3)),
24
+ c: parseFloat(o.oklch[1].toFixed(3)),
25
+ h: Math.floor(o.oklch[2])
26
+ },
27
+ lab: {
28
+ l: Math.floor(o.lab[0]),
29
+ a: Math.floor(o.lab[1]),
30
+ b: Math.floor(o.lab[2])
31
+ },
32
+ oklab: {
33
+ l: parseFloat(o.oklab[0].toFixed(3)),
34
+ a: parseFloat(o.oklab[1].toFixed(3)),
35
+ b: parseFloat(o.oklab[2].toFixed(3))
36
+ },
37
+ hsl: {
38
+ h: Math.floor(o.hsl[0]),
39
+ s: Math.floor(o.hsl[1] * 100),
40
+ l: Math.floor(o.hsl[2] * 100)
41
+ },
42
+ hsluv: {
43
+ h: Math.floor(o.hsluv[0]),
44
+ s: Math.floor(o.hsluv[1]),
45
+ l: Math.floor(o.hsluv[2])
46
+ },
47
+ hex: o.hex,
48
+ description: o.description,
49
+ type: "color shade/tint"
50
+ }), s = (o, e) => ({
51
+ rgb: {
52
+ r: Math.floor(e.rgb[0]),
53
+ g: Math.floor(e.rgb[1]),
54
+ b: Math.floor(e.rgb[2])
55
+ },
56
+ gl: {
57
+ r: parseFloat(e.gl[0].toFixed(3)),
58
+ g: parseFloat(e.gl[1].toFixed(3)),
59
+ b: parseFloat(e.gl[2].toFixed(3))
60
+ },
61
+ lch: {
62
+ l: Math.floor(e.lch[0]),
63
+ c: Math.floor(e.lch[1]),
64
+ h: Math.floor(e.lch[2])
65
+ },
66
+ oklch: {
67
+ l: parseFloat(e.oklch[0].toFixed(3)),
68
+ c: parseFloat(e.oklch[1].toFixed(3)),
69
+ h: Math.floor(e.oklch[2])
70
+ },
71
+ lab: {
72
+ l: Math.floor(e.lab[0]),
73
+ a: Math.floor(e.lab[1]),
74
+ b: Math.floor(e.lab[2])
75
+ },
76
+ oklab: {
77
+ l: parseFloat(e.oklab[0].toFixed(3)),
78
+ a: parseFloat(e.oklab[1].toFixed(3)),
79
+ b: parseFloat(e.oklab[2].toFixed(3))
80
+ },
81
+ hsl: {
82
+ h: Math.floor(e.hsl[0]),
83
+ s: Math.floor(e.hsl[1] * 100),
84
+ l: Math.floor(e.hsl[2] * 100)
85
+ },
86
+ hsluv: {
87
+ h: Math.floor(e.hsluv[0]),
88
+ s: Math.floor(e.hsluv[1]),
89
+ l: Math.floor(e.hsluv[2])
90
+ },
91
+ hex: e.hex,
92
+ alpha: o.alpha,
93
+ description: o.description,
94
+ type: "color shade/tint"
95
+ });
96
+ return h[0].type === "custom theme" ? h.forEach((o) => {
97
+ a[o.name] = {}, o.colors.forEach((e) => {
98
+ const t = e.shades.find(
99
+ (i) => i.type === "source color"
100
+ );
101
+ a[o.name][e.name] = {}, e.shades.forEach((i) => {
102
+ i && t && (a[o.name][e.name][i.name] = i.isTransparent ? s(i, t) : n(i));
103
+ }), a[o.name][e.name].description = e.description, a[o.name][e.name].type = "color";
104
+ }), a[o.name].description = o.description, a[o.name].type = "color mode";
105
+ }) : h.forEach((o) => {
106
+ o.colors.forEach((e) => {
107
+ const t = e.shades.find(
108
+ (i) => i.type === "source color"
109
+ );
110
+ a[e.name] = {}, e.shades.forEach((i) => {
111
+ i && t && (a[e.name][i.name] = i.isTransparent ? s(i, t) : n(i));
112
+ }), a[e.name].description = e.description, a[e.name].type = "color";
113
+ });
114
+ }), a.description = c.description, a.type = "color palette", JSON.stringify(a, null, " ");
115
+ };
116
+ var T = Object.defineProperty, d = (c, h, a) => h in c ? T(c, h, { enumerable: !0, configurable: !0, writable: !0, value: a }) : c[h] = a, C = (c, h, a) => d(c, typeof h != "symbol" ? h + "" : h, a);
117
+ class $ {
118
+ constructor(h) {
119
+ C(this, "string"), C(this, "doSnakeCase", () => this.string.toLowerCase().split(" ").join("_").replace(/[@/$^%#&!?.,;:+=<>(){}"«»]/g, "")), C(this, "doPascalCase", () => this.string.charAt(0).toUpperCase() + this.string.toLowerCase().replace(/[^a-zA-Z0-9]+(.)/g, (a) => a.toUpperCase()).replace(/[@/$^%#&!?.,;:+=<>(){}"«» ]/g, "").slice(1)), C(this, "doKebabCase", () => this.string.toLowerCase().split(" ").join("-").replace(/[@/$^%#&!?.,;:+=<>(){}"«»]/g, "")), C(this, "doCamelCase", () => this.string.toLowerCase().replace(/[^a-zA-Z0-9]+(.)/g, (a) => a.toUpperCase()).replace(/[@/$^%#&!?.,;:+=<>(){}"«» ]/g, "")), this.string = h;
120
+ }
121
+ }
122
+ const v = (c) => {
123
+ const h = c.themes.filter((n) => n.type === "custom theme").length === 0 ? c.themes.filter((n) => n.type === "default theme") : c.themes.filter((n) => n.type === "custom theme"), a = [];
124
+ return h.forEach((n) => {
125
+ const s = [];
126
+ n.colors.forEach((o) => {
127
+ const e = o.shades.find((t) => t.type === "source color");
128
+ s.push(`// ${o.name}`), o.shades.reverse().forEach((t) => {
129
+ s.push(
130
+ t.isTransparent ? `static let ${new $(o.name).doPascalCase()}${t.name === "source" ? "Source" : t.name} = UIColor(red: ${e == null ? void 0 : e.gl[0].toFixed(
131
+ 3
132
+ )}, green: ${e == null ? void 0 : e.gl[1].toFixed(3)}, blue: ${e == null ? void 0 : e.gl[2].toFixed(
133
+ 3
134
+ )}, alpha: ${t.alpha ?? 1})` : `static let ${new $(o.name).doPascalCase()}${t.name === "source" ? "Source" : t.name} = UIColor(red: ${t.gl[0].toFixed(
135
+ 3
136
+ )}, green: ${t.gl[1].toFixed(3)}, blue: ${t.gl[2].toFixed(
137
+ 3
138
+ )})`
139
+ );
140
+ }), s.push("");
141
+ }), s.pop(), h[0].type === "custom theme" ? a.push(
142
+ `// ${n.name}
143
+ struct ${new $(n.name).doPascalCase()} {
144
+ ${s.join(
145
+ `
146
+ `
147
+ )}
148
+ }`
149
+ ) : a.push(`${s.join(`
150
+ `)}`);
151
+ }), `import UIKit
152
+
153
+ struct Color {
154
+ ${a.join(`
155
+
156
+ `)}
157
+ }`;
158
+ }, K = (c) => {
159
+ const h = c.themes.filter((n) => n.type === "custom theme").length === 0 ? c.themes.filter((n) => n.type === "default theme") : c.themes.filter((n) => n.type === "custom theme");
160
+ let a = `@import "tailwindcss";
161
+
162
+ @theme {
163
+ --color-*: initial;
164
+
165
+ `;
166
+ return h[0].type !== "custom theme" ? h.forEach((n) => {
167
+ n.colors.forEach((s) => {
168
+ const o = s.shades.find(
169
+ (l) => l.type === "source color"
170
+ ), e = new $(s.name).doKebabCase();
171
+ a += ` /* ${s.name} */
172
+ `, s.shades.sort().forEach((l) => {
173
+ const m = l.isTransparent ? k((o == null ? void 0 : o.hex) ?? "#000000").alpha(l.alpha ?? 1).hex() : l.hex, r = new $(l.name).doKebabCase();
174
+ a += ` --color-${e}-${r}: ${m};
175
+ `;
176
+ });
177
+ const t = s === n.colors[n.colors.length - 1], i = n === h[h.length - 1];
178
+ t && i || (a += `
179
+ `);
180
+ });
181
+ }) : h.forEach((n) => {
182
+ const s = new $(n.name).doKebabCase();
183
+ n.colors.forEach((o) => {
184
+ const e = o.shades.find(
185
+ (m) => m.type === "source color"
186
+ ), t = new $(o.name).doKebabCase();
187
+ a += ` /* ${n.name} - ${o.name} */
188
+ `, o.shades.forEach((m) => {
189
+ const r = m.isTransparent ? k((e == null ? void 0 : e.hex) ?? "#000000").alpha(m.alpha ?? 1).hex() : m.hex, p = new $(m.name).doKebabCase();
190
+ a += ` --color-${s}-${t}-${p}: ${r};
191
+ `;
192
+ });
193
+ const i = o === n.colors[n.colors.length - 1], l = n === h[h.length - 1];
194
+ i && l || (a += `
195
+ `);
196
+ });
197
+ }), a += `}
198
+ `, a;
199
+ }, S = (c) => {
200
+ const h = c.themes.filter((n) => n.type === "custom theme").length === 0 ? c.themes.filter((n) => n.type === "default theme") : c.themes.filter((n) => n.type === "custom theme"), a = {
201
+ theme: {
202
+ colors: {}
203
+ }
204
+ };
205
+ return c.themes[0].colors.forEach((n) => {
206
+ a.theme.colors[new $(n.name).doKebabCase()] = {};
207
+ }), h[0].type === "custom theme" ? h.forEach((n) => {
208
+ n.colors.forEach((s) => {
209
+ const o = s.shades.find(
210
+ (e) => e.type === "source color"
211
+ );
212
+ a.theme.colors[new $(s.name).doKebabCase()][new $(n.name).doKebabCase()] = {}, s.shades.forEach((e) => {
213
+ a.theme.colors[new $(s.name).doKebabCase()][new $(n.name).doKebabCase()][new $(e.name).doKebabCase()] = e.isTransparent ? k((o == null ? void 0 : o.hex) ?? "#000000").alpha(e.alpha ?? 1).hex() : e.hex;
214
+ });
215
+ });
216
+ }) : h.forEach((n) => {
217
+ n.colors.forEach((s) => {
218
+ const o = s.shades.find(
219
+ (e) => e.type === "source color"
220
+ );
221
+ a.theme.colors[new $(s.name).doKebabCase()] = {}, s.shades.sort().forEach((e) => {
222
+ a.theme.colors[new $(s.name).doKebabCase()][new $(e.name).doKebabCase()] = e.isTransparent ? k((o == null ? void 0 : o.hex) ?? "#000000").alpha(e.alpha ?? 1).hex() : e.hex;
223
+ });
224
+ });
225
+ }), `/** @type {import('tailwindcss').Config} */
226
+ module.exports = ${JSON.stringify(a, null, " ")}`;
227
+ }, L = (c) => {
228
+ const h = c.themes.filter((n) => n.type === "custom theme").length === 0 ? c.themes.filter((n) => n.type === "default theme") : c.themes.filter((n) => n.type === "custom theme"), a = [];
229
+ return h.forEach((n) => {
230
+ n.colors.forEach((s) => {
231
+ const o = s.shades.find((t) => t.type === "source color"), e = [];
232
+ e.push(
233
+ `// ${h[0].type === "custom theme" ? n.name + " - " : ""}${s.name}`
234
+ ), s.shades.reverse().forEach((t) => {
235
+ e.push(
236
+ t.isTransparent ? `public let ${h[0].type === "custom theme" ? new $(n.name + " " + s.name).doPascalCase() : new $(s.name).doPascalCase()}${t.name === "source" ? "Source" : t.name} = Color(red: ${o == null ? void 0 : o.gl[0].toFixed(
237
+ 3
238
+ )}, green: ${o == null ? void 0 : o.gl[1].toFixed(3)}, blue: ${t.gl[2].toFixed(
239
+ 3
240
+ )}).opacity(${t.alpha ?? 1})` : `public let ${h[0].type === "custom theme" ? new $(n.name + " " + s.name).doPascalCase() : new $(s.name).doPascalCase()}${t.name === "source" ? "Source" : t.name} = Color(red: ${t.gl[0].toFixed(
241
+ 3
242
+ )}, green: ${t.gl[1].toFixed(3)}, blue: ${t.gl[2].toFixed(
243
+ 3
244
+ )})`
245
+ );
246
+ }), e.push(""), e.forEach((t) => a.push(t));
247
+ });
248
+ }), a.pop(), `import SwiftUI
249
+
250
+ public extension Color {
251
+ static let Token = Color.TokenColor()
252
+ struct TokenColor {
253
+ ${a.join(
254
+ `
255
+ `
256
+ )}
257
+ }
258
+ }`;
259
+ }, j = (c) => {
260
+ const h = c.themes.filter((s) => s.type === "custom theme").length === 0 ? c.themes.filter((s) => s.type === "default theme") : c.themes.filter((s) => s.type === "custom theme"), a = {
261
+ color: {}
262
+ }, n = (s, o, e) => ({
263
+ type: "color",
264
+ value: o.isTransparent ? k(e.hex).alpha(o.alpha ?? 1).hex() : o.hex,
265
+ comment: s.description !== "" ? s.description + " - " + o.description : o.description
266
+ });
267
+ return c.themes[0].colors.forEach((s) => {
268
+ a.color[s.name] = {};
269
+ }), h[0].type === "custom theme" ? h.forEach((s) => {
270
+ s.colors.forEach((o) => {
271
+ const e = o.shades.find(
272
+ (t) => t.type === "source color"
273
+ );
274
+ a.color[o.name][s.name] = {}, o.shades.forEach((t) => {
275
+ t && e && (a.color[o.name][s.name][t.name] = n(
276
+ o,
277
+ t,
278
+ e
279
+ ));
280
+ });
281
+ });
282
+ }) : h.forEach((s) => {
283
+ s.colors.forEach((o) => {
284
+ const e = o.shades.find(
285
+ (t) => t.type === "source color"
286
+ );
287
+ a.color[o.name] = {}, o.shades.forEach((t) => {
288
+ t && e && (a.color[o.name][t.name] = n(o, t, e));
289
+ });
290
+ });
291
+ }), JSON.stringify(a, null, " ");
292
+ }, H = (c, h) => {
293
+ const a = c.themes.filter((r) => r.type === "custom theme").length === 0 ? c.themes.filter((r) => r.type === "default theme") : c.themes.filter((r) => r.type === "custom theme"), n = [], s = [], o = (r) => {
294
+ var f;
295
+ isNaN(r.hsl[0]) && (r.hsl[0] = 0), isNaN(r.lch[2]) && (r.lch[2] = 0), isNaN(r.oklch[2]) && (r.oklch[2] = 0);
296
+ const p = {
297
+ RGB: () => `rgb(${Math.floor(r.rgb[0])}, ${Math.floor(
298
+ r.rgb[1]
299
+ )}, ${Math.floor(r.rgb[2])})`,
300
+ HEX: () => r.hex,
301
+ HSL: () => `hsl(${Math.floor(r.hsl[0])} ${Math.floor(
302
+ r.hsl[1] * 100
303
+ )}% ${Math.floor(r.hsl[2] * 100)}%)`,
304
+ LCH: () => `lch(${Math.floor(r.lch[0])}% ${Math.floor(
305
+ r.lch[1]
306
+ )} ${Math.floor(r.lch[2])})`,
307
+ OKLCH: () => `oklch(${Math.floor(r.oklch[0] * 100)}% ${r.oklch[1].toFixed(3)} ${Math.floor(r.oklch[2])})`
308
+ };
309
+ return (f = p[h ?? "RGB"]) == null ? void 0 : f.call(p);
310
+ }, e = (r, p) => {
311
+ var g;
312
+ isNaN(r.hsl[0]) && (r.hsl[0] = 0), isNaN(r.lch[2]) && (r.lch[2] = 0), isNaN(r.oklch[2]) && (r.oklch[2] = 0);
313
+ const f = {
314
+ RGB: () => {
315
+ var u;
316
+ return `rgba(${Math.floor(p.rgb[0])}, ${Math.floor(
317
+ p.rgb[1]
318
+ )}, ${Math.floor(p.rgb[2])}, ${((u = r.alpha) == null ? void 0 : u.toFixed(2)) ?? 1})`;
319
+ },
320
+ HEX: () => k(p.hex).alpha(r.alpha ?? 1).hex(),
321
+ HSL: () => {
322
+ var u;
323
+ return `hsla(${Math.floor(p.hsl[0])} ${Math.floor(
324
+ p.hsl[1] * 100
325
+ )}%, ${Math.floor(p.hsl[2] * 100)}% ${((u = r.alpha) == null ? void 0 : u.toFixed(2)) ?? 1})`;
326
+ },
327
+ LCH: () => {
328
+ var u;
329
+ return `lch(${Math.floor(p.lch[0])}% ${Math.floor(
330
+ p.lch[1]
331
+ )} ${Math.floor(p.lch[2])} / ${((u = r.alpha) == null ? void 0 : u.toFixed(2)) ?? 1})`;
332
+ },
333
+ OKLCH: () => {
334
+ var u;
335
+ return `oklch(${Math.floor(p.oklch[0 * 100])}% ${p.oklch[1].toFixed(3)} ${Math.floor(p.oklch[2])} / ${((u = r.alpha) == null ? void 0 : u.toFixed(2)) ?? 1})`;
336
+ }
337
+ };
338
+ return (g = f[h ?? "RGB"]) == null ? void 0 : g.call(f);
339
+ }, t = a.find(
340
+ (r) => r.type === "default theme"
341
+ );
342
+ if (t) {
343
+ const r = [];
344
+ return t.colors.forEach((p, f) => {
345
+ f > 0 && r.push(""), r.push(`// ${p.name}`), p.shades.reverse().forEach((g) => {
346
+ const u = p.shades.find((y) => y.type === "source color"), x = `$${new $(p.name).doKebabCase()}-${g.name}`;
347
+ u && r.push(
348
+ `${x}: ${g.isTransparent ? e(g, u) : o(g)};`
349
+ );
350
+ });
351
+ }), n.push(r.join(`
352
+ `)), n.join(`
353
+ `);
354
+ }
355
+ a.forEach((r) => {
356
+ const p = new $(r.name).doKebabCase(), f = [];
357
+ f.push(`// ${r.name}`), f.push(`@mixin ${p} {`), r.colors.forEach((g, u) => {
358
+ u > 0 && f.push(""), f.push(` // ${g.name}`), g.shades.reverse().forEach((x) => {
359
+ const y = g.shades.find((F) => F.type === "source color"), M = `--${new $(g.name).doKebabCase()}-${x.name}`;
360
+ y && f.push(
361
+ ` ${M}: ${x.isTransparent ? e(x, y) : o(x)};`
362
+ );
363
+ });
364
+ }), f.push("}"), n.push(f.join(`
365
+ `));
366
+ });
367
+ const i = /* @__PURE__ */ new Set();
368
+ if (a.forEach((r) => {
369
+ r.colors.forEach((p) => {
370
+ p.shades.forEach((f) => {
371
+ if (p.shades.find((u) => u.type === "source color")) {
372
+ const x = `--${new $(p.name).doKebabCase()}-${f.name}`;
373
+ i.add(x);
374
+ }
375
+ });
376
+ });
377
+ }), i.size > 0) {
378
+ const r = /* @__PURE__ */ new Map();
379
+ i.forEach((p) => {
380
+ const f = p.match(/--([a-zA-Z0-9-]+)-([a-zA-Z0-9-]+)/);
381
+ if (f) {
382
+ const g = f[1];
383
+ r.has(g) || r.set(g, []);
384
+ const u = `$${p.substring(2)}`;
385
+ r.get(g).push(`${u}: var(${p});`);
386
+ }
387
+ }), r.forEach((p, f) => {
388
+ s.push(
389
+ `// ${f.charAt(0).toUpperCase() + f.slice(1)}`
390
+ ), s.push(...p), s.push("");
391
+ }), s.length > 0 && s[s.length - 1] === "" && s.pop(), n.push(s.join(`
392
+ `));
393
+ }
394
+ const l = [":root {"];
395
+ a.forEach((r, p) => {
396
+ const f = new $(r.name).doKebabCase();
397
+ l.push(` &[data-theme="${f}"] {
398
+ @include ${f};
399
+ }`), p !== a.length - 1 && l.push("");
400
+ }), l.push("}"), n.push(l.join(`
401
+ `));
402
+ const m = [];
403
+ return a.forEach((r) => {
404
+ const p = new $(r.name).doKebabCase();
405
+ m.push(`.${p} {
406
+ @include ${p};
407
+ }`);
408
+ }), n.push(m.join(`
409
+
410
+ `)), n.join(`
411
+
412
+ `);
413
+ }, V = (c) => {
414
+ const h = c.themes.filter((n) => n.type === "custom theme").length === 0 ? c.themes.filter((n) => n.type === "default theme") : c.themes.filter((n) => n.type === "custom theme"), a = [];
415
+ return h.forEach((n) => {
416
+ n.colors.forEach((s) => {
417
+ const o = s.shades.find((t) => t.type === "source color"), e = [];
418
+ e.push(
419
+ `<!--${h[0].type === "custom theme" ? `${n.name} - ${s.name}-->` : `${s.name}-->`}`
420
+ ), s.shades.reverse().forEach((t) => {
421
+ e.push(
422
+ `<color name="${h[0].type === "custom theme" ? new $(n.name + " " + s.name).doSnakeCase() : new $(s.name).doSnakeCase()}_${t.name}">${t.isTransparent ? k((o == null ? void 0 : o.hex) ?? "#000000").alpha(t.alpha ?? 1).hex() : t.hex}</color>`
423
+ );
424
+ }), e.push(""), e.forEach((t) => a.push(t));
425
+ });
426
+ }), a.pop(), `<?xml version="1.0" encoding="utf-8"?>
427
+ <resources>
428
+ ${a.join(
429
+ `
430
+ `
431
+ )}
432
+ </resources>`;
433
+ }, B = (c) => {
434
+ const h = 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"), a = {
435
+ $themes: [],
436
+ $metadata: {
437
+ activeThemes: [],
438
+ tokenSetOrder: [],
439
+ activeSets: []
440
+ }
441
+ }, n = c.name, s = (o, e, t) => ({
442
+ $type: "color",
443
+ $value: e.isTransparent ? k(t.hex).alpha(e.alpha ?? 1).hex() : e.hex,
444
+ $description: o.description !== "" ? o.description + " - " + e.description : e.description
445
+ });
446
+ return h[0].type === "custom theme" ? h.forEach((o) => {
447
+ o.colors.forEach((e) => {
448
+ const t = e.shades.find(
449
+ (i) => i.type === "source color"
450
+ );
451
+ a[`${o.name}/${e.name}`] = {}, e.shades.forEach((i) => {
452
+ i && t && (a[`${o.name}/${e.name}`][i.name] = s(
453
+ e,
454
+ i,
455
+ t
456
+ ));
457
+ });
458
+ });
459
+ }) : h.forEach((o) => {
460
+ o.colors.forEach((e) => {
461
+ const t = e.shades.find(
462
+ (i) => i.type === "source color"
463
+ );
464
+ a[`${n}/${e.name}`] = {}, e.shades.forEach((i) => {
465
+ i && t && (a[`${n}/${e.name}`][i.name] = s(
466
+ e,
467
+ i,
468
+ t
469
+ ));
470
+ });
471
+ });
472
+ }), JSON.stringify(a, null, " ");
473
+ }, R = (c, h) => {
474
+ const a = 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"), n = [], s = (l) => {
475
+ var r;
476
+ isNaN(l.hsl[0]) && (l.hsl[0] = 0), isNaN(l.lch[2]) && (l.lch[2] = 0), isNaN(l.oklch[2]) && (l.oklch[2] = 0);
477
+ const m = {
478
+ RGB: () => `rgb(${Math.floor(l.rgb[0])}, ${Math.floor(
479
+ l.rgb[1]
480
+ )}, ${Math.floor(l.rgb[2])})`,
481
+ HEX: () => l.hex,
482
+ HSL: () => `hsl(${Math.floor(l.hsl[0])} ${Math.floor(
483
+ l.hsl[1] * 100
484
+ )}% ${Math.floor(l.hsl[2] * 100)}%)`,
485
+ LCH: () => `lch(${Math.floor(l.lch[0])}% ${Math.floor(
486
+ l.lch[1]
487
+ )} ${Math.floor(l.lch[2])})`,
488
+ OKLCH: () => `oklch(${Math.floor(l.oklch[0] * 100)}% ${l.oklch[1].toFixed(3)} ${Math.floor(l.oklch[2])})`
489
+ };
490
+ return (r = m[h ?? "RGB"]) == null ? void 0 : r.call(m);
491
+ }, o = (l, m) => {
492
+ var p;
493
+ isNaN(l.hsl[0]) && (l.hsl[0] = 0), isNaN(l.lch[2]) && (l.lch[2] = 0), isNaN(l.oklch[2]) && (l.oklch[2] = 0);
494
+ const r = {
495
+ RGB: () => {
496
+ var f;
497
+ return `rgba(${Math.floor(m.rgb[0])}, ${Math.floor(
498
+ m.rgb[1]
499
+ )}, ${Math.floor(m.rgb[2])}, ${((f = l.alpha) == null ? void 0 : f.toFixed(2)) ?? 1})`;
500
+ },
501
+ HEX: () => k(m.hex).alpha(l.alpha ?? 1).hex(),
502
+ HSL: () => {
503
+ var f;
504
+ return `hsla(${Math.floor(m.hsl[0])}, ${Math.floor(
505
+ m.hsl[1] * 100
506
+ )}% ${Math.floor(m.hsl[2] * 100)}% ${((f = l.alpha) == null ? void 0 : f.toFixed(2)) ?? 1})`;
507
+ },
508
+ LCH: () => {
509
+ var f;
510
+ return `lch(${Math.floor(m.lch[0])}% ${Math.floor(
511
+ m.lch[1]
512
+ )} ${Math.floor(m.lch[2])} / ${((f = l.alpha) == null ? void 0 : f.toFixed(2)) ?? 1})`;
513
+ },
514
+ OKLCH: () => {
515
+ var f;
516
+ return `oklch(${Math.floor(m.oklch[0] * 100)}% ${m.oklch[1].toFixed(3)} ${Math.floor(m.oklch[2])} / ${((f = l.alpha) == null ? void 0 : f.toFixed(2)) ?? 1})`;
517
+ }
518
+ };
519
+ return (p = r[h ?? "RGB"]) == null ? void 0 : p.call(r);
520
+ }, e = a.find(
521
+ (l) => l.type === "default theme"
522
+ );
523
+ if (e) {
524
+ const l = [];
525
+ return e.colors.forEach((m, r) => {
526
+ r > 0 && l.push(""), l.push(`// ${m.name}`), m.shades.reverse().forEach((p) => {
527
+ const f = m.shades.find((u) => u.type === "source color"), g = `@${new $(m.name).doKebabCase()}-${p.name}`;
528
+ f && l.push(
529
+ `${g}: ${p.isTransparent ? o(p, f) : s(p)};`
530
+ );
531
+ });
532
+ }), n.push(l.join(`
533
+ `)), n.join(`
534
+ `);
535
+ }
536
+ a.forEach((l) => {
537
+ const m = new $(l.name).doKebabCase(), r = [];
538
+ r.push(`// ${l.name}`), r.push(`.${m}() {`), l.colors.forEach((p, f) => {
539
+ f > 0 && r.push(""), r.push(` // ${p.name}`), p.shades.reverse().forEach((g) => {
540
+ const u = p.shades.find((y) => y.type === "source color"), x = `@${new $(p.name).doKebabCase()}-${g.name}`;
541
+ u && r.push(
542
+ ` ${x}: ${g.isTransparent ? o(g, u) : s(g)};`
543
+ );
544
+ });
545
+ }), r.push("}"), n.push(r.join(`
546
+ `));
547
+ });
548
+ const t = [":root {"];
549
+ a.forEach((l, m) => {
550
+ const r = new $(l.name).doKebabCase();
551
+ t.push(` &[data-theme="${r}"] {
552
+ .${r}();
553
+ }`), m !== a.length - 1 && t.push("");
554
+ }), t.push("}"), n.push(t.join(`
555
+ `));
556
+ const i = [];
557
+ return a.forEach((l) => {
558
+ const m = new $(l.name).doKebabCase();
559
+ i.push(`.${m} {
560
+ .${m}();
561
+ }`);
562
+ }), n.push(i.join(`
563
+
564
+ `)), n.join(`
565
+
566
+ `);
567
+ }, G = (c, h) => {
568
+ const a = 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"), n = {}, s = (e) => {
569
+ var i;
570
+ isNaN(e.oklch[2]) && (e.oklch[2] = 0);
571
+ const t = {
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 (i = t[h ?? "RGB"]) == null ? void 0 : i.call(t);
592
+ }, o = (e, t) => {
593
+ var l;
594
+ isNaN(t.oklch[2]) && (t.oklch[2] = 0);
595
+ const i = {
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: t.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: t.alpha
615
+ })
616
+ };
617
+ return (l = i[h ?? "RGB"]) == null ? void 0 : l.call(i);
618
+ };
619
+ return a[0].type === "custom theme" ? a.forEach((e) => {
620
+ e.colors.forEach((t) => {
621
+ const i = t.shades.find(
622
+ (l) => l.type === "source color"
623
+ );
624
+ n[t.name] || (n[t.name] = {
625
+ $type: "color"
626
+ }), t.shades.forEach((l) => {
627
+ !n[t.name][l.name] && i && (n[t.name][l.name] = {
628
+ $type: "color",
629
+ $value: l.isTransparent ? o(i, l) : s(l),
630
+ $description: t.description !== "" ? t.description + " - " + l.description : l.description,
631
+ $extensions: {
632
+ mode: {}
633
+ }
634
+ }), i && (n[t.name][l.name].$extensions.mode[e.name] = l.isTransparent ? o(i, l) : s(l));
635
+ });
636
+ });
637
+ }) : a.forEach((e) => {
638
+ e.colors.forEach((t) => {
639
+ const i = t.shades.find(
640
+ (l) => l.type === "source color"
641
+ );
642
+ n[t.name] = {}, t.shades.forEach((l) => {
643
+ l && i && (n[t.name][l.name] = {
644
+ $type: "color",
645
+ $value: l.isTransparent ? o(i, l) : s(l),
646
+ $description: t.description !== "" ? t.description + " - " + l.description : l.description
647
+ });
648
+ });
649
+ });
650
+ }), JSON.stringify(n, null, " ");
651
+ }, A = (c) => {
652
+ const h = c.themes.filter((i) => i.type === "custom theme").length === 0 ? c.themes.filter((i) => i.type === "default theme") : c.themes.filter((i) => i.type === "custom theme"), a = [], n = [], s = [], o = [], e = [], t = [];
653
+ return h.forEach((i) => {
654
+ i.colors.forEach((l) => {
655
+ l.shades.forEach((m) => {
656
+ s.push(m.name), o.push(Math.floor(m.lch[0])), e.push(Math.floor(m.lch[1])), t.push(Math.floor(m.lch[2]));
657
+ }), a.push({
658
+ name: l.name,
659
+ csv: `${l.name},Lightness,Chroma,Hue
660
+ ${s.map((m, r) => `${m},${o[r]},${e[r]},${t[r]}`).join(`
661
+ `)}`
662
+ }), s.splice(0, s.length), o.splice(0, o.length), e.splice(0, e.length), t.splice(0, t.length);
663
+ }), n.push({
664
+ name: i.name,
665
+ colors: a.map((l) => l),
666
+ type: i.type
667
+ }), a.splice(0, a.length);
668
+ }), n;
669
+ }, U = (c, h) => {
670
+ const a = 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"), n = [], s = (e) => {
671
+ var i;
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 t = {
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 (i = t[h ?? "RGB"]) == null ? void 0 : i.call(t);
690
+ }, o = (e, t) => {
691
+ var l;
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 i = {
694
+ RGB: () => {
695
+ var m;
696
+ return `rgb(${Math.floor(t.rgb[0])}, ${Math.floor(
697
+ t.rgb[1]
698
+ )}, ${Math.floor(t.rgb[2])} / ${((m = e.alpha) == null ? void 0 : m.toFixed(2)) ?? 1})`;
699
+ },
700
+ HEX: () => k(t.hex).alpha(e.alpha ?? 1).hex(),
701
+ HSL: () => {
702
+ var m;
703
+ return `hsl(${Math.floor(t.hsl[0])} ${Math.floor(
704
+ t.hsl[1] * 100
705
+ )}% ${Math.floor(t.hsl[2] * 100)}% / ${((m = e.alpha) == null ? void 0 : m.toFixed(2)) ?? 1})`;
706
+ },
707
+ LCH: () => {
708
+ var m;
709
+ return `lch(${Math.floor(t.lch[0])}% ${Math.floor(
710
+ t.lch[1]
711
+ )} ${Math.floor(t.lch[2])} / ${((m = e.alpha) == null ? void 0 : m.toFixed(2)) ?? 1})`;
712
+ },
713
+ OKLCH: () => {
714
+ var m;
715
+ return `oklch(${Math.floor(t.oklch[0 * 100])}% ${t.oklch[1].toFixed(3)} ${Math.floor(t.oklch[2])} / ${((m = e.alpha) == null ? void 0 : m.toFixed(2)) ?? 1})`;
716
+ },
717
+ P3: () => {
718
+ var m;
719
+ return `color(display-p3 ${t.gl[0].toFixed(3)} ${t.gl[1].toFixed(
720
+ 3
721
+ )} ${t.gl[2].toFixed(3)} / ${((m = e.alpha) == null ? void 0 : m.toFixed(2)) ?? 1})`;
722
+ }
723
+ };
724
+ return (l = i[h ?? "RGB"]) == null ? void 0 : l.call(i);
725
+ };
726
+ return a.forEach((e) => {
727
+ const t = [];
728
+ e.colors.forEach((i) => {
729
+ t.push(`/* ${i.name} */`), i.shades.reverse().forEach((l) => {
730
+ const m = i.shades.find((r) => r.type === "source color");
731
+ m && t.push(
732
+ `--${new $(i.name).doKebabCase()}-${l.name}: ${l.isTransparent ? o(l, m) : s(l)};`
733
+ );
734
+ }), t.push("");
735
+ }), t.pop(), n.push(
736
+ `${e.type === "custom theme" ? `/* ${e.name} */
737
+ ` : ""}:root${e.type === "custom theme" ? `[data-theme='${new $(e.name).doKebabCase()}']` : ""} {
738
+ ${t.join(`
739
+ `)}
740
+ }`
741
+ );
742
+ }), n.join(`
743
+
744
+ `);
745
+ }, O = (c) => {
746
+ const h = c.themes.filter((n) => n.type === "custom theme").length === 0 ? c.themes.filter((n) => n.type === "default theme") : c.themes.filter((n) => n.type === "custom theme"), a = [];
747
+ return h.forEach((n) => {
748
+ n.colors.forEach((s) => {
749
+ const o = s.shades.find((t) => t.type === "source color"), e = [];
750
+ e.push(
751
+ `// ${h[0].type === "custom theme" ? n.name + " - " : ""}${s.name}`
752
+ ), s.shades.reverse().forEach((t) => {
753
+ e.push(
754
+ `val ${h[0].type === "custom theme" ? new $(n.name + " " + s.name).doSnakeCase() : new $(s.name).doSnakeCase()}_${t.name} = Color(${t.isTransparent ? k((o == null ? void 0 : o.hex) ?? "#000000").alpha(t.alpha ?? 1).hex().replace("#", "0xFF").toUpperCase() : t.hex.replace("#", "0xFF").toUpperCase()})`
755
+ );
756
+ }), e.push(""), e.forEach((t) => a.push(t));
757
+ });
758
+ }), a.pop(), `import androidx.compose.ui.graphics.Color
759
+
760
+ ${a.join(`
761
+ `)}`;
762
+ };
763
+ class X {
764
+ constructor(h) {
765
+ b(this, "paletteData");
766
+ b(this, "makeNativeTokens", () => B(this.paletteData));
767
+ b(this, "makeDtcgTokens", (h = "RGB") => G(this.paletteData, h));
768
+ b(this, "makeStyleDictionaryV3Tokens", () => j(this.paletteData));
769
+ b(this, "makeUniversalJson", () => w(this.paletteData));
770
+ b(this, "makeCssCustomProps", (h = "RGB") => U(this.paletteData, h));
771
+ b(this, "makeScssVariables", (h = "RGB") => H(this.paletteData, h));
772
+ b(this, "makeLessVariables", (h = "RGB") => R(this.paletteData, h));
773
+ b(this, "makeTailwindV3Config", () => S(this.paletteData));
774
+ b(this, "makeTailwindV4Config", () => K(this.paletteData));
775
+ b(this, "makeSwiftUI", () => L(this.paletteData));
776
+ b(this, "makeUIKit", () => v(this.paletteData));
777
+ b(this, "makeCompose", () => O(this.paletteData));
778
+ b(this, "makeResources", () => V(this.paletteData));
779
+ b(this, "makeCsv", () => A(this.paletteData));
780
+ this.paletteData = h;
23
781
  }
24
782
  }
25
783
  export {
26
- v as default
784
+ X as default
27
785
  };
28
786
  //# sourceMappingURL=code.js.map