@a_ng_d/utils-ui-color-palette 1.5.8 → 1.5.10
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.
|
@@ -4,51 +4,51 @@ var k = (m, r, n) => S(m, typeof r != "symbol" ? r + "" : r, n);
|
|
|
4
4
|
import { C as x, H as M } from "../../color-1CXTuV84.js";
|
|
5
5
|
import { c as u } from "../../index-Beb8qoyd.js";
|
|
6
6
|
const N = (m) => {
|
|
7
|
-
const r = m.themes.filter((
|
|
7
|
+
const r = m.themes.filter((a) => a.type === "custom theme").length === 0 ? m.themes.filter((a) => a.type === "default theme") : m.themes.filter((a) => a.type === "custom theme"), n = {}, o = (a) => (isNaN(a.hsl[0]) && (a.hsl[0] = 0), isNaN(a.lch[2]) && (a.lch[2] = 0), isNaN(a.oklch[2]) && (a.oklch[2] = 0), {
|
|
8
8
|
rgb: {
|
|
9
|
-
r: Math.floor(
|
|
10
|
-
g: Math.floor(
|
|
11
|
-
b: Math.floor(
|
|
9
|
+
r: Math.floor(a.rgb[0]),
|
|
10
|
+
g: Math.floor(a.rgb[1]),
|
|
11
|
+
b: Math.floor(a.rgb[2])
|
|
12
12
|
},
|
|
13
13
|
gl: {
|
|
14
|
-
r: parseFloat(
|
|
15
|
-
g: parseFloat(
|
|
16
|
-
b: parseFloat(
|
|
14
|
+
r: parseFloat(a.gl[0].toFixed(3)),
|
|
15
|
+
g: parseFloat(a.gl[1].toFixed(3)),
|
|
16
|
+
b: parseFloat(a.gl[2].toFixed(3))
|
|
17
17
|
},
|
|
18
18
|
lch: {
|
|
19
|
-
l: Math.floor(
|
|
20
|
-
c: Math.floor(
|
|
21
|
-
h: Math.floor(
|
|
19
|
+
l: Math.floor(a.lch[0]),
|
|
20
|
+
c: Math.floor(a.lch[1]),
|
|
21
|
+
h: Math.floor(a.lch[2])
|
|
22
22
|
},
|
|
23
23
|
oklch: {
|
|
24
|
-
l: parseFloat(
|
|
25
|
-
c: parseFloat(
|
|
26
|
-
h: Math.floor(
|
|
24
|
+
l: parseFloat(a.oklch[0].toFixed(3)),
|
|
25
|
+
c: parseFloat(a.oklch[1].toFixed(3)),
|
|
26
|
+
h: Math.floor(a.oklch[2])
|
|
27
27
|
},
|
|
28
28
|
lab: {
|
|
29
|
-
l: Math.floor(
|
|
30
|
-
a: Math.floor(
|
|
31
|
-
b: Math.floor(
|
|
29
|
+
l: Math.floor(a.lab[0]),
|
|
30
|
+
a: Math.floor(a.lab[1]),
|
|
31
|
+
b: Math.floor(a.lab[2])
|
|
32
32
|
},
|
|
33
33
|
oklab: {
|
|
34
|
-
l: parseFloat(
|
|
35
|
-
a: parseFloat(
|
|
36
|
-
b: parseFloat(
|
|
34
|
+
l: parseFloat(a.oklab[0].toFixed(3)),
|
|
35
|
+
a: parseFloat(a.oklab[1].toFixed(3)),
|
|
36
|
+
b: parseFloat(a.oklab[2].toFixed(3))
|
|
37
37
|
},
|
|
38
38
|
hsl: {
|
|
39
|
-
h: Math.floor(
|
|
40
|
-
s: Math.floor(
|
|
41
|
-
l: Math.floor(
|
|
39
|
+
h: Math.floor(a.hsl[0]),
|
|
40
|
+
s: Math.floor(a.hsl[1] * 100),
|
|
41
|
+
l: Math.floor(a.hsl[2] * 100)
|
|
42
42
|
},
|
|
43
43
|
hsluv: {
|
|
44
|
-
h: Math.floor(
|
|
45
|
-
s: Math.floor(
|
|
46
|
-
l: Math.floor(
|
|
44
|
+
h: Math.floor(a.hsluv[0]),
|
|
45
|
+
s: Math.floor(a.hsluv[1]),
|
|
46
|
+
l: Math.floor(a.hsluv[2])
|
|
47
47
|
},
|
|
48
|
-
hex:
|
|
49
|
-
description:
|
|
48
|
+
hex: a.hex,
|
|
49
|
+
description: a.description,
|
|
50
50
|
type: "color shade/tint"
|
|
51
|
-
}),
|
|
51
|
+
}), c = (a, e) => ({
|
|
52
52
|
rgb: {
|
|
53
53
|
r: Math.floor(e.rgb[0]),
|
|
54
54
|
g: Math.floor(e.rgb[1]),
|
|
@@ -90,26 +90,26 @@ const N = (m) => {
|
|
|
90
90
|
l: Math.floor(e.hsluv[2])
|
|
91
91
|
},
|
|
92
92
|
hex: e.hex,
|
|
93
|
-
alpha:
|
|
94
|
-
description:
|
|
93
|
+
alpha: a.alpha,
|
|
94
|
+
description: a.description,
|
|
95
95
|
type: "color shade/tint"
|
|
96
96
|
});
|
|
97
|
-
return r[0].type === "custom theme" ? r.forEach((
|
|
98
|
-
n[
|
|
99
|
-
const
|
|
100
|
-
(
|
|
97
|
+
return r[0].type === "custom theme" ? r.forEach((a) => {
|
|
98
|
+
n[a.name] = {}, a.colors.forEach((e) => {
|
|
99
|
+
const t = e.shades.find(
|
|
100
|
+
(i) => i.type === "source color"
|
|
101
101
|
);
|
|
102
|
-
n[
|
|
103
|
-
|
|
104
|
-
}), n[
|
|
105
|
-
}), n[
|
|
106
|
-
}) : r.forEach((
|
|
107
|
-
|
|
108
|
-
const
|
|
109
|
-
(
|
|
102
|
+
n[a.name][e.name] = {}, e.shades.forEach((i) => {
|
|
103
|
+
i && t && (n[a.name][e.name][i.name] = i.isTransparent ? c(i, t) : o(i));
|
|
104
|
+
}), n[a.name][e.name].description = e.description, n[a.name][e.name].type = "color";
|
|
105
|
+
}), n[a.name].description = a.description, n[a.name].type = "color mode";
|
|
106
|
+
}) : r.forEach((a) => {
|
|
107
|
+
a.colors.forEach((e) => {
|
|
108
|
+
const t = e.shades.find(
|
|
109
|
+
(i) => i.type === "source color"
|
|
110
110
|
);
|
|
111
|
-
n[e.name] = {}, e.shades.forEach((
|
|
112
|
-
|
|
111
|
+
n[e.name] = {}, e.shades.forEach((i) => {
|
|
112
|
+
i && t && (n[e.name][i.name] = i.isTransparent ? c(i, t) : o(i));
|
|
113
113
|
}), n[e.name].description = e.description, n[e.name].type = "color";
|
|
114
114
|
});
|
|
115
115
|
}), n.description = m.description, n.type = "color palette", JSON.stringify(n, null, " ");
|
|
@@ -121,33 +121,33 @@ class b {
|
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
123
|
const L = (m) => {
|
|
124
|
-
const r = m.themes.filter((
|
|
125
|
-
return r.forEach((
|
|
126
|
-
const
|
|
127
|
-
|
|
128
|
-
const e =
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
124
|
+
const r = m.themes.filter((o) => o.type === "custom theme").length === 0 ? m.themes.filter((o) => o.type === "default theme") : m.themes.filter((o) => o.type === "custom theme"), n = [];
|
|
125
|
+
return r.forEach((o) => {
|
|
126
|
+
const c = [];
|
|
127
|
+
o.colors.forEach((a) => {
|
|
128
|
+
const e = a.shades.find((t) => t.type === "source color");
|
|
129
|
+
c.push(`// ${a.name}`), a.shades.reverse().forEach((t) => {
|
|
130
|
+
c.push(
|
|
131
|
+
t.isTransparent ? `static let ${new b(a.name).doPascalCase()}${t.name === "source" ? "Source" : t.name} = UIColor(red: ${e == null ? void 0 : e.gl[0].toFixed(
|
|
132
132
|
3
|
|
133
133
|
)}, green: ${e == null ? void 0 : e.gl[1].toFixed(3)}, blue: ${e == null ? void 0 : e.gl[2].toFixed(
|
|
134
134
|
3
|
|
135
|
-
)}, alpha: ${
|
|
135
|
+
)}, alpha: ${t.alpha ?? 1})` : `static let ${new b(a.name).doPascalCase()}${t.name === "source" ? "Source" : t.name} = UIColor(red: ${t.gl[0].toFixed(
|
|
136
136
|
3
|
|
137
|
-
)}, green: ${
|
|
137
|
+
)}, green: ${t.gl[1].toFixed(3)}, blue: ${t.gl[2].toFixed(
|
|
138
138
|
3
|
|
139
139
|
)})`
|
|
140
140
|
);
|
|
141
|
-
}),
|
|
142
|
-
}),
|
|
143
|
-
`// ${
|
|
144
|
-
struct ${new b(
|
|
145
|
-
${
|
|
141
|
+
}), c.push("");
|
|
142
|
+
}), c.pop(), r[0].type === "custom theme" ? n.push(
|
|
143
|
+
`// ${o.name}
|
|
144
|
+
struct ${new b(o.name).doPascalCase()} {
|
|
145
|
+
${c.join(
|
|
146
146
|
`
|
|
147
147
|
`
|
|
148
148
|
)}
|
|
149
149
|
}`
|
|
150
|
-
) : n.push(`${
|
|
150
|
+
) : n.push(`${c.join(`
|
|
151
151
|
`)}`);
|
|
152
152
|
}), `import UIKit
|
|
153
153
|
|
|
@@ -157,98 +157,99 @@ struct Color {
|
|
|
157
157
|
`)}
|
|
158
158
|
}`;
|
|
159
159
|
}, H = (m) => {
|
|
160
|
-
const r = m.themes.filter((
|
|
160
|
+
const r = m.themes.filter((o) => o.type === "custom theme").length === 0 ? m.themes.filter((o) => o.type === "default theme") : m.themes.filter((o) => o.type === "custom theme");
|
|
161
161
|
let n = `@import "tailwindcss";
|
|
162
162
|
|
|
163
163
|
@theme {
|
|
164
164
|
--color-*: initial;
|
|
165
165
|
|
|
166
166
|
`;
|
|
167
|
-
return r[0].type !== "custom theme" ? r.forEach((
|
|
168
|
-
|
|
169
|
-
const
|
|
167
|
+
return r[0].type !== "custom theme" ? r.forEach((o) => {
|
|
168
|
+
o.colors.forEach((c) => {
|
|
169
|
+
const a = c.shades.find(
|
|
170
170
|
(l) => l.type === "source color"
|
|
171
|
-
), e = new b(
|
|
172
|
-
n += ` /* ${
|
|
173
|
-
`,
|
|
174
|
-
const h = l.isTransparent ? u((
|
|
171
|
+
), e = new b(c.name).doKebabCase();
|
|
172
|
+
n += ` /* ${c.name} */
|
|
173
|
+
`, c.shades.sort().forEach((l) => {
|
|
174
|
+
const h = l.isTransparent ? u((a == null ? void 0 : a.hex) ?? "#000000").alpha(l.alpha ?? 1).hex() : l.hex, s = new b(l.name).doKebabCase();
|
|
175
175
|
n += ` --color-${e}-${s}: ${h};
|
|
176
176
|
`;
|
|
177
177
|
});
|
|
178
|
-
const
|
|
179
|
-
|
|
178
|
+
const t = c === o.colors[o.colors.length - 1], i = o === r[r.length - 1];
|
|
179
|
+
t && i || (n += `
|
|
180
180
|
`);
|
|
181
181
|
});
|
|
182
|
-
}) : r.forEach((
|
|
183
|
-
const
|
|
184
|
-
|
|
185
|
-
const e =
|
|
182
|
+
}) : r.forEach((o) => {
|
|
183
|
+
const c = new b(o.name).doKebabCase();
|
|
184
|
+
o.colors.forEach((a) => {
|
|
185
|
+
const e = a.shades.find(
|
|
186
186
|
(h) => h.type === "source color"
|
|
187
|
-
),
|
|
188
|
-
n += ` /* ${
|
|
189
|
-
`,
|
|
187
|
+
), t = new b(a.name).doKebabCase();
|
|
188
|
+
n += ` /* ${o.name} - ${a.name} */
|
|
189
|
+
`, a.shades.forEach((h) => {
|
|
190
190
|
const s = h.isTransparent ? u((e == null ? void 0 : e.hex) ?? "#000000").alpha(h.alpha ?? 1).hex() : h.hex, p = new b(h.name).doKebabCase();
|
|
191
|
-
n += ` --color-${
|
|
191
|
+
n += ` --color-${c}-${t}-${p}: ${s};
|
|
192
192
|
`;
|
|
193
193
|
});
|
|
194
|
-
const
|
|
195
|
-
|
|
194
|
+
const i = a === o.colors[o.colors.length - 1], l = o === r[r.length - 1];
|
|
195
|
+
i && l || (n += `
|
|
196
196
|
`);
|
|
197
197
|
});
|
|
198
198
|
}), n += `}
|
|
199
199
|
`, n;
|
|
200
200
|
}, K = (m) => {
|
|
201
|
-
const r = m.themes.filter((
|
|
201
|
+
const r = m.themes.filter((a) => a.type === "custom theme").length === 0 ? m.themes.filter((a) => a.type === "default theme") : m.themes.filter((a) => a.type === "custom theme"), n = {
|
|
202
202
|
theme: {
|
|
203
203
|
colors: {}
|
|
204
204
|
}
|
|
205
205
|
};
|
|
206
|
-
return m.themes[0].colors.forEach((
|
|
207
|
-
n.theme.colors[new b(
|
|
208
|
-
}), r[0].type === "custom theme" ? r.forEach((
|
|
209
|
-
|
|
210
|
-
const
|
|
211
|
-
(
|
|
206
|
+
return m.themes[0].colors.forEach((a) => {
|
|
207
|
+
n.theme.colors[new b(a.name).doKebabCase()] = {};
|
|
208
|
+
}), r[0].type === "custom theme" ? r.forEach((a) => {
|
|
209
|
+
a.colors.forEach((e) => {
|
|
210
|
+
const t = e.shades.find(
|
|
211
|
+
(i) => i.type === "source color"
|
|
212
212
|
);
|
|
213
|
-
n.theme.colors[new b(
|
|
214
|
-
n.theme.colors[new b(
|
|
213
|
+
n.theme.colors[new b(e.name).doKebabCase()][new b(a.name).doKebabCase()] = {}, e.shades.forEach((i) => {
|
|
214
|
+
n.theme.colors[new b(e.name).doKebabCase()][new b(a.name).doKebabCase()][new b(i.name).doKebabCase()] = i.isTransparent ? u((t == null ? void 0 : t.hex) ?? "#000000").alpha(i.alpha ?? 1).hex() : i.hex;
|
|
215
215
|
});
|
|
216
216
|
});
|
|
217
|
-
}) : r.forEach((
|
|
218
|
-
|
|
219
|
-
const
|
|
220
|
-
(
|
|
217
|
+
}) : r.forEach((a) => {
|
|
218
|
+
a.colors.forEach((e) => {
|
|
219
|
+
const t = e.shades.find(
|
|
220
|
+
(i) => i.type === "source color"
|
|
221
221
|
);
|
|
222
|
-
n.theme.colors[new b(
|
|
223
|
-
n.theme.colors[new b(
|
|
222
|
+
n.theme.colors[new b(e.name).doKebabCase()] = {}, e.shades.sort().forEach((i) => {
|
|
223
|
+
n.theme.colors[new b(e.name).doKebabCase()][new b(i.name).doKebabCase()] = i.isTransparent ? u((t == null ? void 0 : t.hex) ?? "#000000").alpha(i.alpha ?? 1).hex() : i.hex;
|
|
224
224
|
});
|
|
225
225
|
});
|
|
226
|
-
}), `/** @type {
|
|
226
|
+
}), `/** @type {${"i" + "mport"}('tailwindcss').Config} */
|
|
227
|
+
|
|
227
228
|
module.exports = ${JSON.stringify(
|
|
228
229
|
n,
|
|
229
230
|
null,
|
|
230
231
|
" "
|
|
231
232
|
)}`;
|
|
232
233
|
}, A = (m) => {
|
|
233
|
-
const r = m.themes.filter((
|
|
234
|
-
return r.forEach((
|
|
235
|
-
|
|
236
|
-
const
|
|
234
|
+
const r = m.themes.filter((o) => o.type === "custom theme").length === 0 ? m.themes.filter((o) => o.type === "default theme") : m.themes.filter((o) => o.type === "custom theme"), n = [];
|
|
235
|
+
return r.forEach((o) => {
|
|
236
|
+
o.colors.forEach((c) => {
|
|
237
|
+
const a = c.shades.find((t) => t.type === "source color"), e = [];
|
|
237
238
|
e.push(
|
|
238
|
-
`// ${r[0].type === "custom theme" ?
|
|
239
|
-
),
|
|
239
|
+
`// ${r[0].type === "custom theme" ? o.name + " - " : ""}${c.name}`
|
|
240
|
+
), c.shades.reverse().forEach((t) => {
|
|
240
241
|
e.push(
|
|
241
|
-
|
|
242
|
+
t.isTransparent ? `public let ${r[0].type === "custom theme" ? new b(o.name + " " + c.name).doPascalCase() : new b(c.name).doPascalCase()}${t.name === "source" ? "Source" : t.name} = Color(red: ${a == null ? void 0 : a.gl[0].toFixed(
|
|
242
243
|
3
|
|
243
|
-
)}, green: ${
|
|
244
|
+
)}, green: ${a == null ? void 0 : a.gl[1].toFixed(3)}, blue: ${t.gl[2].toFixed(
|
|
244
245
|
3
|
|
245
|
-
)}).opacity(${
|
|
246
|
+
)}).opacity(${t.alpha ?? 1})` : `public let ${r[0].type === "custom theme" ? new b(o.name + " " + c.name).doPascalCase() : new b(c.name).doPascalCase()}${t.name === "source" ? "Source" : t.name} = Color(red: ${t.gl[0].toFixed(
|
|
246
247
|
3
|
|
247
|
-
)}, green: ${
|
|
248
|
+
)}, green: ${t.gl[1].toFixed(3)}, blue: ${t.gl[2].toFixed(
|
|
248
249
|
3
|
|
249
250
|
)})`
|
|
250
251
|
);
|
|
251
|
-
}), e.push(""), e.forEach((
|
|
252
|
+
}), e.push(""), e.forEach((t) => n.push(t));
|
|
252
253
|
});
|
|
253
254
|
}), n.pop(), `import SwiftUI
|
|
254
255
|
|
|
@@ -262,40 +263,40 @@ public extension Color {
|
|
|
262
263
|
}
|
|
263
264
|
}`;
|
|
264
265
|
}, V = (m) => {
|
|
265
|
-
const r = m.themes.filter((
|
|
266
|
+
const r = m.themes.filter((c) => c.type === "custom theme").length === 0 ? m.themes.filter((c) => c.type === "default theme") : m.themes.filter((c) => c.type === "custom theme"), n = {
|
|
266
267
|
color: {}
|
|
267
|
-
},
|
|
268
|
+
}, o = (c, a, e) => ({
|
|
268
269
|
type: "color",
|
|
269
|
-
value:
|
|
270
|
-
comment:
|
|
270
|
+
value: a.isTransparent ? u(e.hex).alpha(a.alpha ?? 1).hex() : a.hex,
|
|
271
|
+
comment: c.description !== "" ? c.description + " - " + a.description : a.description
|
|
271
272
|
});
|
|
272
|
-
return m.themes[0].colors.forEach((
|
|
273
|
-
n.color[
|
|
274
|
-
}), r[0].type === "custom theme" ? r.forEach((
|
|
275
|
-
|
|
276
|
-
const e =
|
|
277
|
-
(
|
|
273
|
+
return m.themes[0].colors.forEach((c) => {
|
|
274
|
+
n.color[c.name] = {};
|
|
275
|
+
}), r[0].type === "custom theme" ? r.forEach((c) => {
|
|
276
|
+
c.colors.forEach((a) => {
|
|
277
|
+
const e = a.shades.find(
|
|
278
|
+
(t) => t.type === "source color"
|
|
278
279
|
);
|
|
279
|
-
n.color[
|
|
280
|
-
|
|
281
|
-
o,
|
|
280
|
+
n.color[a.name][c.name] = {}, a.shades.forEach((t) => {
|
|
281
|
+
t && e && (n.color[a.name][c.name][t.name] = o(
|
|
282
282
|
a,
|
|
283
|
+
t,
|
|
283
284
|
e
|
|
284
285
|
));
|
|
285
286
|
});
|
|
286
287
|
});
|
|
287
|
-
}) : r.forEach((
|
|
288
|
-
|
|
289
|
-
const e =
|
|
290
|
-
(
|
|
288
|
+
}) : r.forEach((c) => {
|
|
289
|
+
c.colors.forEach((a) => {
|
|
290
|
+
const e = a.shades.find(
|
|
291
|
+
(t) => t.type === "source color"
|
|
291
292
|
);
|
|
292
|
-
n.color[
|
|
293
|
-
|
|
293
|
+
n.color[a.name] = {}, a.shades.forEach((t) => {
|
|
294
|
+
t && e && (n.color[a.name][t.name] = o(a, t, e));
|
|
294
295
|
});
|
|
295
296
|
});
|
|
296
297
|
}), JSON.stringify(n, null, " ");
|
|
297
298
|
}, P = (m, r) => {
|
|
298
|
-
const n = m.themes.filter((s) => s.type === "custom theme").length === 0 ? m.themes.filter((s) => s.type === "default theme") : m.themes.filter((s) => s.type === "custom theme"),
|
|
299
|
+
const n = m.themes.filter((s) => s.type === "custom theme").length === 0 ? m.themes.filter((s) => s.type === "default theme") : m.themes.filter((s) => s.type === "custom theme"), o = [], c = [], a = (s) => {
|
|
299
300
|
var f;
|
|
300
301
|
isNaN(s.hsl[0]) && (s.hsl[0] = 0), isNaN(s.lch[2]) && (s.lch[2] = 0), isNaN(s.oklch[2]) && (s.oklch[2] = 0);
|
|
301
302
|
const p = {
|
|
@@ -341,20 +342,20 @@ public extension Color {
|
|
|
341
342
|
}
|
|
342
343
|
};
|
|
343
344
|
return ($ = f[r ?? "RGB"]) == null ? void 0 : $.call(f);
|
|
344
|
-
},
|
|
345
|
+
}, t = n.find(
|
|
345
346
|
(s) => s.type === "default theme"
|
|
346
347
|
);
|
|
347
|
-
if (
|
|
348
|
+
if (t) {
|
|
348
349
|
const s = [];
|
|
349
|
-
return
|
|
350
|
+
return t.colors.forEach((p, f) => {
|
|
350
351
|
f > 0 && s.push(""), s.push(`// ${p.name}`), p.shades.reverse().forEach(($) => {
|
|
351
352
|
const g = p.shades.find((C) => C.type === "source color"), d = `$${new b(p.name).doKebabCase()}-${$.name}`;
|
|
352
353
|
g && s.push(
|
|
353
|
-
`${d}: ${$.isTransparent ? e($, g) :
|
|
354
|
+
`${d}: ${$.isTransparent ? e($, g) : a($)};`
|
|
354
355
|
);
|
|
355
356
|
});
|
|
356
|
-
}),
|
|
357
|
-
`)),
|
|
357
|
+
}), o.push(s.join(`
|
|
358
|
+
`)), o.join(`
|
|
358
359
|
`);
|
|
359
360
|
}
|
|
360
361
|
n.forEach((s) => {
|
|
@@ -363,25 +364,25 @@ public extension Color {
|
|
|
363
364
|
g > 0 && f.push(""), f.push(` // ${$.name}`), $.shades.reverse().forEach((d) => {
|
|
364
365
|
const C = $.shades.find((F) => F.type === "source color"), E = `--${new b($.name).doKebabCase()}-${d.name}`;
|
|
365
366
|
C && f.push(
|
|
366
|
-
` ${E}: ${d.isTransparent ? e(d, C) :
|
|
367
|
+
` ${E}: ${d.isTransparent ? e(d, C) : a(d)};`
|
|
367
368
|
);
|
|
368
369
|
});
|
|
369
|
-
}), f.push("}"),
|
|
370
|
+
}), f.push("}"), o.push(f.join(`
|
|
370
371
|
`));
|
|
371
372
|
});
|
|
372
|
-
const
|
|
373
|
+
const i = /* @__PURE__ */ new Set();
|
|
373
374
|
if (n.forEach((s) => {
|
|
374
375
|
s.colors.forEach((p) => {
|
|
375
376
|
p.shades.forEach((f) => {
|
|
376
377
|
if (p.shades.find((g) => g.type === "source color")) {
|
|
377
378
|
const d = `--${new b(p.name).doKebabCase()}-${f.name}`;
|
|
378
|
-
|
|
379
|
+
i.add(d);
|
|
379
380
|
}
|
|
380
381
|
});
|
|
381
382
|
});
|
|
382
|
-
}),
|
|
383
|
+
}), i.size > 0) {
|
|
383
384
|
const s = /* @__PURE__ */ new Map();
|
|
384
|
-
|
|
385
|
+
i.forEach((p) => {
|
|
385
386
|
const f = p.match(/--([a-zA-Z0-9-]+)-([a-zA-Z0-9-]+)/);
|
|
386
387
|
if (f) {
|
|
387
388
|
const $ = f[1];
|
|
@@ -390,10 +391,10 @@ public extension Color {
|
|
|
390
391
|
s.get($).push(`${g}: var(${p});`);
|
|
391
392
|
}
|
|
392
393
|
}), s.forEach((p, f) => {
|
|
393
|
-
|
|
394
|
+
c.push(
|
|
394
395
|
`// ${f.charAt(0).toUpperCase() + f.slice(1)}`
|
|
395
|
-
),
|
|
396
|
-
}),
|
|
396
|
+
), c.push(...p), c.push("");
|
|
397
|
+
}), c.length > 0 && c[c.length - 1] === "" && c.pop(), o.push(c.join(`
|
|
397
398
|
`));
|
|
398
399
|
}
|
|
399
400
|
const l = [":root {"];
|
|
@@ -402,7 +403,7 @@ public extension Color {
|
|
|
402
403
|
l.push(` &[data-theme="${f}"] {
|
|
403
404
|
@include ${f};
|
|
404
405
|
}`), p !== n.length - 1 && l.push("");
|
|
405
|
-
}), l.push("}"),
|
|
406
|
+
}), l.push("}"), o.push(l.join(`
|
|
406
407
|
`));
|
|
407
408
|
const h = [];
|
|
408
409
|
return n.forEach((s) => {
|
|
@@ -410,23 +411,23 @@ public extension Color {
|
|
|
410
411
|
h.push(`.${p} {
|
|
411
412
|
@include ${p};
|
|
412
413
|
}`);
|
|
413
|
-
}),
|
|
414
|
+
}), o.push(h.join(`
|
|
414
415
|
|
|
415
|
-
`)),
|
|
416
|
+
`)), o.join(`
|
|
416
417
|
|
|
417
418
|
`);
|
|
418
419
|
}, j = (m) => {
|
|
419
|
-
const r = m.themes.filter((
|
|
420
|
-
return r.forEach((
|
|
421
|
-
|
|
422
|
-
const
|
|
420
|
+
const r = m.themes.filter((o) => o.type === "custom theme").length === 0 ? m.themes.filter((o) => o.type === "default theme") : m.themes.filter((o) => o.type === "custom theme"), n = [];
|
|
421
|
+
return r.forEach((o) => {
|
|
422
|
+
o.colors.forEach((c) => {
|
|
423
|
+
const a = c.shades.find((t) => t.type === "source color"), e = [];
|
|
423
424
|
e.push(
|
|
424
|
-
`<!--${r[0].type === "custom theme" ? `${
|
|
425
|
-
),
|
|
425
|
+
`<!--${r[0].type === "custom theme" ? `${o.name} - ${c.name}-->` : `${c.name}-->`}`
|
|
426
|
+
), c.shades.reverse().forEach((t) => {
|
|
426
427
|
e.push(
|
|
427
|
-
`<color name="${r[0].type === "custom theme" ? new b(
|
|
428
|
+
`<color name="${r[0].type === "custom theme" ? new b(o.name + " " + c.name).doSnakeCase() : new b(c.name).doSnakeCase()}_${t.name}">${t.isTransparent ? u((a == null ? void 0 : a.hex) ?? "#000000").alpha(t.alpha ?? 1).hex() : t.hex}</color>`
|
|
428
429
|
);
|
|
429
|
-
}), e.push(""), e.forEach((
|
|
430
|
+
}), e.push(""), e.forEach((t) => n.push(t));
|
|
430
431
|
});
|
|
431
432
|
}), n.pop(), `<?xml version="1.0" encoding="utf-8"?>
|
|
432
433
|
<resources>
|
|
@@ -436,47 +437,47 @@ public extension Color {
|
|
|
436
437
|
)}
|
|
437
438
|
</resources>`;
|
|
438
439
|
}, B = (m) => {
|
|
439
|
-
const r = m.themes.filter((
|
|
440
|
+
const r = m.themes.filter((a) => a.type === "custom theme").length === 0 ? m.themes.filter((a) => a.type === "default theme") : m.themes.filter((a) => a.type === "custom theme"), n = {
|
|
440
441
|
$themes: [],
|
|
441
442
|
$metadata: {
|
|
442
443
|
activeThemes: [],
|
|
443
444
|
tokenSetOrder: [],
|
|
444
445
|
activeSets: []
|
|
445
446
|
}
|
|
446
|
-
},
|
|
447
|
+
}, o = m.name, c = (a, e, t) => ({
|
|
447
448
|
$type: "color",
|
|
448
|
-
$value: e.isTransparent ? u(
|
|
449
|
-
$description:
|
|
449
|
+
$value: e.isTransparent ? u(t.hex).alpha(e.alpha ?? 1).hex() : e.hex,
|
|
450
|
+
$description: a.description !== "" ? a.description + " - " + e.description : e.description
|
|
450
451
|
});
|
|
451
|
-
return r[0].type === "custom theme" ? r.forEach((
|
|
452
|
-
|
|
453
|
-
const
|
|
454
|
-
(
|
|
452
|
+
return r[0].type === "custom theme" ? r.forEach((a) => {
|
|
453
|
+
a.colors.forEach((e) => {
|
|
454
|
+
const t = e.shades.find(
|
|
455
|
+
(i) => i.type === "source color"
|
|
455
456
|
);
|
|
456
|
-
n[`${
|
|
457
|
-
|
|
457
|
+
n[`${a.name}/${e.name}`] = {}, e.shades.forEach((i) => {
|
|
458
|
+
i && t && (n[`${a.name}/${e.name}`][i.name] = c(
|
|
458
459
|
e,
|
|
459
|
-
|
|
460
|
-
|
|
460
|
+
i,
|
|
461
|
+
t
|
|
461
462
|
));
|
|
462
463
|
});
|
|
463
464
|
});
|
|
464
|
-
}) : r.forEach((
|
|
465
|
-
|
|
466
|
-
const
|
|
467
|
-
(
|
|
465
|
+
}) : r.forEach((a) => {
|
|
466
|
+
a.colors.forEach((e) => {
|
|
467
|
+
const t = e.shades.find(
|
|
468
|
+
(i) => i.type === "source color"
|
|
468
469
|
);
|
|
469
|
-
n[`${
|
|
470
|
-
|
|
470
|
+
n[`${o}/${e.name}`] = {}, e.shades.forEach((i) => {
|
|
471
|
+
i && t && (n[`${o}/${e.name}`][i.name] = c(
|
|
471
472
|
e,
|
|
472
|
-
|
|
473
|
-
|
|
473
|
+
i,
|
|
474
|
+
t
|
|
474
475
|
));
|
|
475
476
|
});
|
|
476
477
|
});
|
|
477
478
|
}), JSON.stringify(n, null, " ");
|
|
478
479
|
}, R = (m, r) => {
|
|
479
|
-
const n = m.themes.filter((l) => l.type === "custom theme").length === 0 ? m.themes.filter((l) => l.type === "default theme") : m.themes.filter((l) => l.type === "custom theme"),
|
|
480
|
+
const n = m.themes.filter((l) => l.type === "custom theme").length === 0 ? m.themes.filter((l) => l.type === "default theme") : m.themes.filter((l) => l.type === "custom theme"), o = [], c = (l) => {
|
|
480
481
|
var s;
|
|
481
482
|
isNaN(l.hsl[0]) && (l.hsl[0] = 0), isNaN(l.lch[2]) && (l.lch[2] = 0), isNaN(l.oklch[2]) && (l.oklch[2] = 0);
|
|
482
483
|
const h = {
|
|
@@ -493,7 +494,7 @@ public extension Color {
|
|
|
493
494
|
OKLCH: () => `oklch(${Math.floor(l.oklch[0] * 100)}% ${l.oklch[1].toFixed(3)} ${Math.floor(l.oklch[2])})`
|
|
494
495
|
};
|
|
495
496
|
return (s = h[r ?? "RGB"]) == null ? void 0 : s.call(h);
|
|
496
|
-
},
|
|
497
|
+
}, a = (l, h) => {
|
|
497
498
|
var p;
|
|
498
499
|
isNaN(l.hsl[0]) && (l.hsl[0] = 0), isNaN(l.lch[2]) && (l.lch[2] = 0), isNaN(l.oklch[2]) && (l.oklch[2] = 0);
|
|
499
500
|
const s = {
|
|
@@ -531,11 +532,11 @@ public extension Color {
|
|
|
531
532
|
s > 0 && l.push(""), l.push(`// ${h.name}`), h.shades.reverse().forEach((p) => {
|
|
532
533
|
const f = h.shades.find((g) => g.type === "source color"), $ = `@${new b(h.name).doKebabCase()}-${p.name}`;
|
|
533
534
|
f && l.push(
|
|
534
|
-
`${$}: ${p.isTransparent ?
|
|
535
|
+
`${$}: ${p.isTransparent ? a(p, f) : c(p)};`
|
|
535
536
|
);
|
|
536
537
|
});
|
|
537
|
-
}),
|
|
538
|
-
`)),
|
|
538
|
+
}), o.push(l.join(`
|
|
539
|
+
`)), o.join(`
|
|
539
540
|
`);
|
|
540
541
|
}
|
|
541
542
|
n.forEach((l) => {
|
|
@@ -544,36 +545,36 @@ public extension Color {
|
|
|
544
545
|
f > 0 && s.push(""), s.push(` // ${p.name}`), p.shades.reverse().forEach(($) => {
|
|
545
546
|
const g = p.shades.find((C) => C.type === "source color"), d = `@${new b(p.name).doKebabCase()}-${$.name}`;
|
|
546
547
|
g && s.push(
|
|
547
|
-
` ${d}: ${$.isTransparent ?
|
|
548
|
+
` ${d}: ${$.isTransparent ? a($, g) : c($)};`
|
|
548
549
|
);
|
|
549
550
|
});
|
|
550
|
-
}), s.push("}"),
|
|
551
|
+
}), s.push("}"), o.push(s.join(`
|
|
551
552
|
`));
|
|
552
553
|
});
|
|
553
|
-
const
|
|
554
|
+
const t = [":root {"];
|
|
554
555
|
n.forEach((l, h) => {
|
|
555
556
|
const s = new b(l.name).doKebabCase();
|
|
556
|
-
|
|
557
|
+
t.push(` &[data-theme="${s}"] {
|
|
557
558
|
.${s}();
|
|
558
|
-
}`), h !== n.length - 1 &&
|
|
559
|
-
}),
|
|
559
|
+
}`), h !== n.length - 1 && t.push("");
|
|
560
|
+
}), t.push("}"), o.push(t.join(`
|
|
560
561
|
`));
|
|
561
|
-
const
|
|
562
|
+
const i = [];
|
|
562
563
|
return n.forEach((l) => {
|
|
563
564
|
const h = new b(l.name).doKebabCase();
|
|
564
|
-
|
|
565
|
+
i.push(`.${h} {
|
|
565
566
|
.${h}();
|
|
566
567
|
}`);
|
|
567
|
-
}),
|
|
568
|
+
}), o.push(i.join(`
|
|
568
569
|
|
|
569
|
-
`)),
|
|
570
|
+
`)), o.join(`
|
|
570
571
|
|
|
571
572
|
`);
|
|
572
573
|
}, G = (m, r) => {
|
|
573
|
-
const n = m.themes.filter((e) => e.type === "custom theme").length === 0 ? m.themes.filter((e) => e.type === "default theme") : m.themes.filter((e) => e.type === "custom theme"),
|
|
574
|
-
var
|
|
574
|
+
const n = m.themes.filter((e) => e.type === "custom theme").length === 0 ? m.themes.filter((e) => e.type === "default theme") : m.themes.filter((e) => e.type === "custom theme"), o = {}, c = (e) => {
|
|
575
|
+
var i;
|
|
575
576
|
isNaN(e.oklch[2]) && (e.oklch[2] = 0);
|
|
576
|
-
const
|
|
577
|
+
const t = {
|
|
577
578
|
RGB: () => ({
|
|
578
579
|
colorSpace: "srgb",
|
|
579
580
|
components: [
|
|
@@ -593,11 +594,11 @@ public extension Color {
|
|
|
593
594
|
hex: e.hex
|
|
594
595
|
})
|
|
595
596
|
};
|
|
596
|
-
return (
|
|
597
|
-
},
|
|
597
|
+
return (i = t[r ?? "RGB"]) == null ? void 0 : i.call(t);
|
|
598
|
+
}, a = (e, t) => {
|
|
598
599
|
var l;
|
|
599
|
-
isNaN(
|
|
600
|
-
const
|
|
600
|
+
isNaN(t.oklch[2]) && (t.oklch[2] = 0);
|
|
601
|
+
const i = {
|
|
601
602
|
RGB: () => ({
|
|
602
603
|
colorSpace: "srgb",
|
|
603
604
|
components: [
|
|
@@ -606,7 +607,7 @@ public extension Color {
|
|
|
606
607
|
parseFloat(e.gl[2].toFixed(3))
|
|
607
608
|
],
|
|
608
609
|
hex: e.hex,
|
|
609
|
-
alpha:
|
|
610
|
+
alpha: t.alpha
|
|
610
611
|
}),
|
|
611
612
|
OKLCH: () => ({
|
|
612
613
|
colorSpace: "oklch",
|
|
@@ -616,66 +617,66 @@ public extension Color {
|
|
|
616
617
|
parseFloat(e.oklch[2].toFixed(0))
|
|
617
618
|
],
|
|
618
619
|
hex: e.hex,
|
|
619
|
-
alpha:
|
|
620
|
+
alpha: t.alpha
|
|
620
621
|
})
|
|
621
622
|
};
|
|
622
|
-
return (l =
|
|
623
|
+
return (l = i[r ?? "RGB"]) == null ? void 0 : l.call(i);
|
|
623
624
|
};
|
|
624
625
|
return n[0].type === "custom theme" ? n.forEach((e) => {
|
|
625
|
-
e.colors.forEach((
|
|
626
|
-
const
|
|
626
|
+
e.colors.forEach((t) => {
|
|
627
|
+
const i = t.shades.find(
|
|
627
628
|
(l) => l.type === "source color"
|
|
628
629
|
);
|
|
629
|
-
t
|
|
630
|
+
o[t.name] || (o[t.name] = {
|
|
630
631
|
$type: "color"
|
|
631
|
-
}),
|
|
632
|
-
!t
|
|
632
|
+
}), t.shades.forEach((l) => {
|
|
633
|
+
!o[t.name][l.name] && i && (o[t.name][l.name] = {
|
|
633
634
|
$type: "color",
|
|
634
|
-
$value: l.isTransparent ?
|
|
635
|
-
$description:
|
|
635
|
+
$value: l.isTransparent ? a(i, l) : c(l),
|
|
636
|
+
$description: t.description !== "" ? t.description + " - " + l.description : l.description,
|
|
636
637
|
$extensions: {
|
|
637
638
|
mode: {}
|
|
638
639
|
}
|
|
639
|
-
}),
|
|
640
|
+
}), i && (o[t.name][l.name].$extensions.mode[e.name] = l.isTransparent ? a(i, l) : c(l));
|
|
640
641
|
});
|
|
641
642
|
});
|
|
642
643
|
}) : n.forEach((e) => {
|
|
643
|
-
e.colors.forEach((
|
|
644
|
-
const
|
|
644
|
+
e.colors.forEach((t) => {
|
|
645
|
+
const i = t.shades.find(
|
|
645
646
|
(l) => l.type === "source color"
|
|
646
647
|
);
|
|
647
|
-
t
|
|
648
|
-
l &&
|
|
648
|
+
o[t.name] = {}, t.shades.forEach((l) => {
|
|
649
|
+
l && i && (o[t.name][l.name] = {
|
|
649
650
|
$type: "color",
|
|
650
|
-
$value: l.isTransparent ?
|
|
651
|
-
$description:
|
|
651
|
+
$value: l.isTransparent ? a(i, l) : c(l),
|
|
652
|
+
$description: t.description !== "" ? t.description + " - " + l.description : l.description
|
|
652
653
|
});
|
|
653
654
|
});
|
|
654
655
|
});
|
|
655
|
-
}), JSON.stringify(
|
|
656
|
+
}), JSON.stringify(o, null, " ");
|
|
656
657
|
}, O = (m) => {
|
|
657
|
-
const r = m.themes.filter((
|
|
658
|
-
return r.forEach((
|
|
659
|
-
|
|
658
|
+
const r = m.themes.filter((i) => i.type === "custom theme").length === 0 ? m.themes.filter((i) => i.type === "default theme") : m.themes.filter((i) => i.type === "custom theme"), n = [], o = [], c = [], a = [], e = [], t = [];
|
|
659
|
+
return r.forEach((i) => {
|
|
660
|
+
i.colors.forEach((l) => {
|
|
660
661
|
l.shades.forEach((h) => {
|
|
661
|
-
|
|
662
|
+
c.push(h.name), a.push(Math.floor(h.lch[0])), e.push(Math.floor(h.lch[1])), t.push(Math.floor(h.lch[2]));
|
|
662
663
|
}), n.push({
|
|
663
664
|
name: l.name,
|
|
664
665
|
csv: `${l.name},Lightness,Chroma,Hue
|
|
665
|
-
${
|
|
666
|
+
${c.map((h, s) => `${h},${a[s]},${e[s]},${t[s]}`).join(`
|
|
666
667
|
`)}`
|
|
667
|
-
}),
|
|
668
|
-
}),
|
|
669
|
-
name:
|
|
668
|
+
}), c.splice(0, c.length), a.splice(0, a.length), e.splice(0, e.length), t.splice(0, t.length);
|
|
669
|
+
}), o.push({
|
|
670
|
+
name: i.name,
|
|
670
671
|
colors: n.map((l) => l),
|
|
671
|
-
type:
|
|
672
|
+
type: i.type
|
|
672
673
|
}), n.splice(0, n.length);
|
|
673
|
-
}),
|
|
674
|
+
}), o;
|
|
674
675
|
}, _ = (m, r) => {
|
|
675
|
-
const n = m.themes.filter((e) => e.type === "custom theme").length === 0 ? m.themes.filter((e) => e.type === "default theme") : m.themes.filter((e) => e.type === "custom theme"),
|
|
676
|
-
var
|
|
676
|
+
const n = m.themes.filter((e) => e.type === "custom theme").length === 0 ? m.themes.filter((e) => e.type === "default theme") : m.themes.filter((e) => e.type === "custom theme"), o = [], c = (e) => {
|
|
677
|
+
var i;
|
|
677
678
|
isNaN(e.hsl[0]) && (e.hsl[0] = 0), isNaN(e.lch[2]) && (e.lch[2] = 0);
|
|
678
|
-
const
|
|
679
|
+
const t = {
|
|
679
680
|
RGB: () => `rgb(${Math.floor(e.rgb[0])}, ${Math.floor(
|
|
680
681
|
e.rgb[1]
|
|
681
682
|
)}, ${Math.floor(e.rgb[2])})`,
|
|
@@ -691,73 +692,73 @@ ${i.map((h, s) => `${h},${o[s]},${e[s]},${a[s]}`).join(`
|
|
|
691
692
|
3
|
|
692
693
|
)} ${e.gl[2].toFixed(3)})`
|
|
693
694
|
};
|
|
694
|
-
return (
|
|
695
|
-
},
|
|
695
|
+
return (i = t[r ?? "RGB"]) == null ? void 0 : i.call(t);
|
|
696
|
+
}, a = (e, t) => {
|
|
696
697
|
var l;
|
|
697
|
-
const
|
|
698
|
+
const i = {
|
|
698
699
|
RGB: () => {
|
|
699
700
|
var h;
|
|
700
|
-
return `rgb(${Math.floor(
|
|
701
|
-
|
|
702
|
-
)}, ${Math.floor(
|
|
701
|
+
return `rgb(${Math.floor(t.rgb[0])}, ${Math.floor(
|
|
702
|
+
t.rgb[1]
|
|
703
|
+
)}, ${Math.floor(t.rgb[2])} / ${((h = e.alpha) == null ? void 0 : h.toFixed(2)) ?? 1})`;
|
|
703
704
|
},
|
|
704
|
-
HEX: () => u(
|
|
705
|
+
HEX: () => u(t.hex).alpha(e.alpha ?? 1).hex(),
|
|
705
706
|
HSL: () => {
|
|
706
707
|
var h;
|
|
707
|
-
return `hsl(${Math.floor(
|
|
708
|
-
|
|
709
|
-
)}% ${Math.floor(
|
|
708
|
+
return `hsl(${Math.floor(t.hsl[0])} ${Math.floor(
|
|
709
|
+
t.hsl[1] * 100
|
|
710
|
+
)}% ${Math.floor(t.hsl[2] * 100)}% / ${((h = e.alpha) == null ? void 0 : h.toFixed(2)) ?? 1})`;
|
|
710
711
|
},
|
|
711
712
|
LCH: () => {
|
|
712
713
|
var h;
|
|
713
|
-
return `lch(${Math.floor(
|
|
714
|
-
|
|
715
|
-
)} ${Math.floor(
|
|
714
|
+
return `lch(${Math.floor(t.lch[0])}% ${Math.floor(
|
|
715
|
+
t.lch[1]
|
|
716
|
+
)} ${Math.floor(t.lch[2])} / ${((h = e.alpha) == null ? void 0 : h.toFixed(2)) ?? 1})`;
|
|
716
717
|
},
|
|
717
718
|
OKLCH: () => {
|
|
718
719
|
var h;
|
|
719
|
-
return `oklch(${Math.floor(
|
|
720
|
+
return `oklch(${Math.floor(t.oklch[0])}% ${t.oklch[1].toFixed(3)} ${Math.floor(t.oklch[2])} / ${((h = e.alpha) == null ? void 0 : h.toFixed(2)) ?? 1})`;
|
|
720
721
|
},
|
|
721
722
|
P3: () => {
|
|
722
723
|
var h;
|
|
723
|
-
return `color(display-p3 ${
|
|
724
|
+
return `color(display-p3 ${t.gl[0].toFixed(3)} ${t.gl[1].toFixed(
|
|
724
725
|
3
|
|
725
|
-
)} ${
|
|
726
|
+
)} ${t.gl[2].toFixed(3)} / ${((h = e.alpha) == null ? void 0 : h.toFixed(2)) ?? 1})`;
|
|
726
727
|
}
|
|
727
728
|
};
|
|
728
|
-
return (l =
|
|
729
|
+
return (l = i[r ?? "RGB"]) == null ? void 0 : l.call(i);
|
|
729
730
|
};
|
|
730
731
|
return n.forEach((e) => {
|
|
731
|
-
const
|
|
732
|
-
e.colors.forEach((
|
|
733
|
-
|
|
734
|
-
const h =
|
|
735
|
-
h &&
|
|
736
|
-
`--${new b(
|
|
732
|
+
const t = [];
|
|
733
|
+
e.colors.forEach((i) => {
|
|
734
|
+
t.push(`/* ${i.name} */`), i.shades.reverse().forEach((l) => {
|
|
735
|
+
const h = i.shades.find((s) => s.type === "source color");
|
|
736
|
+
h && t.push(
|
|
737
|
+
`--${new b(i.name).doKebabCase()}-${l.name}: ${l.isTransparent ? a(l, h) : c(l)};`
|
|
737
738
|
);
|
|
738
|
-
}),
|
|
739
|
-
}),
|
|
739
|
+
}), t.push("");
|
|
740
|
+
}), t.pop(), o.push(
|
|
740
741
|
`${e.type === "custom theme" ? `/* ${e.name} */
|
|
741
742
|
` : ""}:root${e.type === "custom theme" ? `[data-theme='${new b(e.name).doKebabCase()}']` : ""} {
|
|
742
|
-
${
|
|
743
|
+
${t.join(`
|
|
743
744
|
`)}
|
|
744
745
|
}`
|
|
745
746
|
);
|
|
746
|
-
}),
|
|
747
|
+
}), o.join(`
|
|
747
748
|
|
|
748
749
|
`);
|
|
749
750
|
}, U = (m) => {
|
|
750
|
-
const r = m.themes.filter((
|
|
751
|
-
return r.forEach((
|
|
752
|
-
|
|
753
|
-
const
|
|
751
|
+
const r = m.themes.filter((o) => o.type === "custom theme").length === 0 ? m.themes.filter((o) => o.type === "default theme") : m.themes.filter((o) => o.type === "custom theme"), n = [];
|
|
752
|
+
return r.forEach((o) => {
|
|
753
|
+
o.colors.forEach((c) => {
|
|
754
|
+
const a = c.shades.find((t) => t.type === "source color"), e = [];
|
|
754
755
|
e.push(
|
|
755
|
-
`// ${r[0].type === "custom theme" ?
|
|
756
|
-
),
|
|
756
|
+
`// ${r[0].type === "custom theme" ? o.name + " - " : ""}${c.name}`
|
|
757
|
+
), c.shades.reverse().forEach((t) => {
|
|
757
758
|
e.push(
|
|
758
|
-
`val ${r[0].type === "custom theme" ? new b(
|
|
759
|
+
`val ${r[0].type === "custom theme" ? new b(o.name + " " + c.name).doSnakeCase() : new b(c.name).doSnakeCase()}_${t.name} = Color(${t.isTransparent ? u((a == null ? void 0 : a.hex) ?? "#000000").alpha(t.alpha ?? 1).hex().replace("#", "0xFF").toUpperCase() : t.hex.replace("#", "0xFF").toUpperCase()})`
|
|
759
760
|
);
|
|
760
|
-
}), e.push(""), e.forEach((
|
|
761
|
+
}), e.push(""), e.forEach((t) => n.push(t));
|
|
761
762
|
});
|
|
762
763
|
}), n.pop(), `import androidx.compose.ui.graphics.Color
|
|
763
764
|
|
|
@@ -768,7 +769,7 @@ class J {
|
|
|
768
769
|
constructor({
|
|
769
770
|
base: r,
|
|
770
771
|
themes: n,
|
|
771
|
-
meta:
|
|
772
|
+
meta: o
|
|
772
773
|
}) {
|
|
773
774
|
k(this, "base");
|
|
774
775
|
k(this, "themes");
|
|
@@ -783,24 +784,24 @@ class J {
|
|
|
783
784
|
colors: [],
|
|
784
785
|
type: r.type
|
|
785
786
|
};
|
|
786
|
-
this.base.colors.forEach((
|
|
787
|
-
const
|
|
788
|
-
if (
|
|
787
|
+
this.base.colors.forEach((o) => {
|
|
788
|
+
const c = Object.entries(r.scale).reverse().map((h) => {
|
|
789
|
+
if (o.alpha.isEnabled) {
|
|
789
790
|
const s = new x({
|
|
790
791
|
render: "RGB",
|
|
791
792
|
sourceColor: [
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
793
|
+
o.rgb.r * 255,
|
|
794
|
+
o.rgb.g * 255,
|
|
795
|
+
o.rgb.b * 255
|
|
795
796
|
],
|
|
796
797
|
alpha: parseFloat((h[1] / 100).toFixed(2)),
|
|
797
|
-
hueShifting:
|
|
798
|
-
chromaShifting:
|
|
798
|
+
hueShifting: o.hue.shift !== void 0 ? o.hue.shift : 0,
|
|
799
|
+
chromaShifting: o.chroma.shift !== void 0 ? o.chroma.shift : 100,
|
|
799
800
|
algorithmVersion: this.base.algorithmVersion,
|
|
800
801
|
visionSimulationMode: r.visionSimulationMode
|
|
801
802
|
}), p = new x({
|
|
802
803
|
render: "RGB",
|
|
803
|
-
sourceColor: u(
|
|
804
|
+
sourceColor: u(o.alpha.backgroundColor).rgb(),
|
|
804
805
|
algorithmVersion: this.base.algorithmVersion,
|
|
805
806
|
visionSimulationMode: r.visionSimulationMode
|
|
806
807
|
});
|
|
@@ -872,13 +873,13 @@ class J {
|
|
|
872
873
|
const s = new x({
|
|
873
874
|
render: "RGB",
|
|
874
875
|
sourceColor: [
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
876
|
+
o.rgb.r * 255,
|
|
877
|
+
o.rgb.g * 255,
|
|
878
|
+
o.rgb.b * 255
|
|
878
879
|
],
|
|
879
880
|
lightness: h[1],
|
|
880
|
-
hueShifting:
|
|
881
|
-
chromaShifting:
|
|
881
|
+
hueShifting: o.hue.shift !== void 0 ? o.hue.shift : 0,
|
|
882
|
+
chromaShifting: o.chroma.shift !== void 0 ? o.chroma.shift : 100,
|
|
882
883
|
algorithmVersion: this.base.algorithmVersion,
|
|
883
884
|
visionSimulationMode: r.visionSimulationMode
|
|
884
885
|
});
|
|
@@ -899,18 +900,18 @@ class J {
|
|
|
899
900
|
return [h, [0, 0, 0]];
|
|
900
901
|
}
|
|
901
902
|
}
|
|
902
|
-
}),
|
|
903
|
-
id:
|
|
904
|
-
name:
|
|
905
|
-
description:
|
|
903
|
+
}), a = {
|
|
904
|
+
id: o.id,
|
|
905
|
+
name: o.name,
|
|
906
|
+
description: o.description,
|
|
906
907
|
shades: [],
|
|
907
908
|
type: "color"
|
|
908
909
|
}, e = [
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
],
|
|
913
|
-
|
|
910
|
+
o.rgb.r * 255,
|
|
911
|
+
o.rgb.g * 255,
|
|
912
|
+
o.rgb.b * 255
|
|
913
|
+
], t = new M();
|
|
914
|
+
t.rgb_r = o.rgb.r, t.rgb_g = o.rgb.g, t.rgb_b = o.rgb.b, t.rgbToHsluv(), a.shades.push({
|
|
914
915
|
name: "source",
|
|
915
916
|
description: "Source color",
|
|
916
917
|
hex: u(e).hex(),
|
|
@@ -922,20 +923,20 @@ class J {
|
|
|
922
923
|
oklab: u(e).oklab(),
|
|
923
924
|
hsl: u(e).hsl(),
|
|
924
925
|
hsluv: [
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
926
|
+
t.hsluv_h,
|
|
927
|
+
t.hsluv_s,
|
|
928
|
+
t.hsluv_l
|
|
928
929
|
],
|
|
929
930
|
type: "source color"
|
|
930
931
|
});
|
|
931
|
-
const
|
|
932
|
+
const i = c.map(
|
|
932
933
|
(h) => u.distance(
|
|
933
934
|
u(e).hex(),
|
|
934
935
|
u(h[1]).hex(),
|
|
935
936
|
"rgb"
|
|
936
937
|
)
|
|
937
|
-
), l =
|
|
938
|
-
|
|
938
|
+
), l = i.indexOf(Math.min(...i));
|
|
939
|
+
c.forEach((h, s) => {
|
|
939
940
|
const p = u.distance(
|
|
940
941
|
u(e).hex(),
|
|
941
942
|
u(h[1]).hex(),
|
|
@@ -951,21 +952,21 @@ class J {
|
|
|
951
952
|
sourceColor: u(e).rgb(),
|
|
952
953
|
visionSimulationMode: r.visionSimulationMode
|
|
953
954
|
}).setColor();
|
|
954
|
-
s === l && this.base.areSourceColorsLocked && !
|
|
955
|
+
s === l && this.base.areSourceColorsLocked && !o.alpha.isEnabled ? ($.rgb_r = Number(g[0]) / 255, $.rgb_g = Number(g[1]) / 255, $.rgb_b = Number(g[2]) / 255) : ($.rgb_r = Number(h[1][0]) / 255, $.rgb_g = Number(h[1][1]) / 255, $.rgb_b = Number(h[1][2]) / 255), $.rgbToHsluv(), a.shades.push({
|
|
955
956
|
name: f,
|
|
956
|
-
description: `Shade/Tint color with ${typeof h[0][1] == "number" ? h[0][1].toFixed(1) : h[0][1]}% of ${
|
|
957
|
-
hex: s === l && this.base.areSourceColorsLocked && !
|
|
958
|
-
rgb: s === l && this.base.areSourceColorsLocked && !
|
|
959
|
-
gl: s === l && this.base.areSourceColorsLocked && !
|
|
960
|
-
lch: s === l && this.base.areSourceColorsLocked && !
|
|
961
|
-
oklch: s === l && this.base.areSourceColorsLocked && !
|
|
962
|
-
lab: s === l && this.base.areSourceColorsLocked && !
|
|
963
|
-
oklab: s === l && this.base.areSourceColorsLocked && !
|
|
964
|
-
hsl: s === l && this.base.areSourceColorsLocked && !
|
|
957
|
+
description: `Shade/Tint color with ${typeof h[0][1] == "number" ? h[0][1].toFixed(1) : h[0][1]}% of ${o.alpha.isEnabled ? "opacity" : "lightness"}`,
|
|
958
|
+
hex: s === l && this.base.areSourceColorsLocked && !o.alpha.isEnabled ? u(d).hex() : u(h[1]).hex(),
|
|
959
|
+
rgb: s === l && this.base.areSourceColorsLocked && !o.alpha.isEnabled ? u(d).rgb() : u(h[1]).rgb(),
|
|
960
|
+
gl: s === l && this.base.areSourceColorsLocked && !o.alpha.isEnabled ? u(d).gl() : u(h[1]).gl(),
|
|
961
|
+
lch: s === l && this.base.areSourceColorsLocked && !o.alpha.isEnabled ? u(d).lch() : u(h[1]).lch(),
|
|
962
|
+
oklch: s === l && this.base.areSourceColorsLocked && !o.alpha.isEnabled ? u(d).oklch() : u(h[1]).oklch(),
|
|
963
|
+
lab: s === l && this.base.areSourceColorsLocked && !o.alpha.isEnabled ? u(d).lab() : u(h[1]).lab(),
|
|
964
|
+
oklab: s === l && this.base.areSourceColorsLocked && !o.alpha.isEnabled ? u(d).oklab() : u(h[1]).oklab(),
|
|
965
|
+
hsl: s === l && this.base.areSourceColorsLocked && !o.alpha.isEnabled ? u(d).hsl() : u(h[1]).hsl(),
|
|
965
966
|
hsluv: [$.hsluv_h, $.hsluv_s, $.hsluv_l],
|
|
966
|
-
alpha:
|
|
967
|
-
backgroundColor:
|
|
968
|
-
mixedColor:
|
|
967
|
+
alpha: o.alpha.isEnabled ? parseFloat((h[0][1] / 100).toFixed(2)) : void 0,
|
|
968
|
+
backgroundColor: o.alpha.isEnabled && o.alpha.backgroundColor ? u(h[2]).rgb() : void 0,
|
|
969
|
+
mixedColor: o.alpha.isEnabled && o.alpha.backgroundColor ? new x({
|
|
969
970
|
visionSimulationMode: r.visionSimulationMode
|
|
970
971
|
}).mixColorsRgb(
|
|
971
972
|
[
|
|
@@ -977,30 +978,30 @@ class J {
|
|
|
977
978
|
[...h[2], 1]
|
|
978
979
|
) : void 0,
|
|
979
980
|
isClosestToRef: p < 4 && !this.base.areSourceColorsLocked,
|
|
980
|
-
isSourceColorLocked: s === l && this.base.areSourceColorsLocked && !
|
|
981
|
-
isTransparent:
|
|
981
|
+
isSourceColorLocked: s === l && this.base.areSourceColorsLocked && !o.alpha.isEnabled,
|
|
982
|
+
isTransparent: o.alpha.isEnabled,
|
|
982
983
|
type: "color shade/tint"
|
|
983
984
|
});
|
|
984
|
-
}), n.colors.push(
|
|
985
|
+
}), n.colors.push(a);
|
|
985
986
|
}), this.paletteData.themes.push(n);
|
|
986
987
|
}), this.paletteData));
|
|
987
988
|
k(this, "makeLibraryData", (r, n) => {
|
|
988
|
-
const
|
|
989
|
-
return
|
|
990
|
-
(
|
|
991
|
-
(e) => e.shades.flatMap((
|
|
992
|
-
const
|
|
993
|
-
(h) => h.id ===
|
|
989
|
+
const o = this.makePaletteData();
|
|
990
|
+
return o.themes.flatMap(
|
|
991
|
+
(a) => a.colors.flatMap(
|
|
992
|
+
(e) => e.shades.flatMap((t) => {
|
|
993
|
+
const i = `${a.id}:${e.id}:${t.name}`, l = n == null ? void 0 : n.find(
|
|
994
|
+
(h) => h.id === i
|
|
994
995
|
);
|
|
995
996
|
return {
|
|
996
|
-
id:
|
|
997
|
-
paletteName:
|
|
998
|
-
themeName:
|
|
997
|
+
id: i,
|
|
998
|
+
paletteName: o.name,
|
|
999
|
+
themeName: a.name,
|
|
999
1000
|
colorName: e.name,
|
|
1000
|
-
shadeName:
|
|
1001
|
-
...(r == null ? void 0 : r.includes("alpha")) && { alpha:
|
|
1002
|
-
...(r == null ? void 0 : r.includes("hex")) && { hex:
|
|
1003
|
-
...(r == null ? void 0 : r.includes("gl")) && { gl:
|
|
1001
|
+
shadeName: t.name,
|
|
1002
|
+
...(r == null ? void 0 : r.includes("alpha")) && { alpha: t.alpha ?? 1 },
|
|
1003
|
+
...(r == null ? void 0 : r.includes("hex")) && { hex: t.hex },
|
|
1004
|
+
...(r == null ? void 0 : r.includes("gl")) && { gl: t.gl },
|
|
1004
1005
|
...(r == null ? void 0 : r.includes("description")) && {
|
|
1005
1006
|
description: e.description
|
|
1006
1007
|
},
|
|
@@ -1085,13 +1086,13 @@ class J {
|
|
|
1085
1086
|
version: "2025.06",
|
|
1086
1087
|
type: "UI_COLOR_PALETTE"
|
|
1087
1088
|
}));
|
|
1088
|
-
var
|
|
1089
|
-
this.base = r, this.themes = n, this.meta =
|
|
1089
|
+
var c;
|
|
1090
|
+
this.base = r, this.themes = n, this.meta = o, this.paletteData = {
|
|
1090
1091
|
name: r.name ?? "UI Color Palette",
|
|
1091
1092
|
description: r.description,
|
|
1092
1093
|
themes: [],
|
|
1093
1094
|
type: "palette"
|
|
1094
|
-
}, this.currentScale = ((
|
|
1095
|
+
}, this.currentScale = ((c = n.find((a) => a.isEnabled)) == null ? void 0 : c.scale) ?? {};
|
|
1095
1096
|
}
|
|
1096
1097
|
}
|
|
1097
1098
|
export {
|