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