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