@a_ng_d/utils-ui-color-palette 1.5.10 → 1.5.11
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,54 +1,54 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var k = (m, r, n) =>
|
|
1
|
+
var N = Object.defineProperty;
|
|
2
|
+
var w = (m, r, n) => r in m ? N(m, r, { enumerable: !0, configurable: !0, writable: !0, value: n }) : m[r] = n;
|
|
3
|
+
var k = (m, r, n) => w(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
|
-
const
|
|
7
|
-
const r = m.themes.filter((
|
|
6
|
+
const S = (m) => {
|
|
7
|
+
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 = {}, a = (o) => (isNaN(o.hsl[0]) && (o.hsl[0] = 0), isNaN(o.lch[2]) && (o.lch[2] = 0), isNaN(o.oklch[2]) && (o.oklch[2] = 0), {
|
|
8
8
|
rgb: {
|
|
9
|
-
r: Math.floor(
|
|
10
|
-
g: Math.floor(
|
|
11
|
-
b: Math.floor(
|
|
9
|
+
r: Math.floor(o.rgb[0]),
|
|
10
|
+
g: Math.floor(o.rgb[1]),
|
|
11
|
+
b: Math.floor(o.rgb[2])
|
|
12
12
|
},
|
|
13
13
|
gl: {
|
|
14
|
-
r: parseFloat(
|
|
15
|
-
g: parseFloat(
|
|
16
|
-
b: parseFloat(
|
|
14
|
+
r: parseFloat(o.gl[0].toFixed(3)),
|
|
15
|
+
g: parseFloat(o.gl[1].toFixed(3)),
|
|
16
|
+
b: parseFloat(o.gl[2].toFixed(3))
|
|
17
17
|
},
|
|
18
18
|
lch: {
|
|
19
|
-
l: Math.floor(
|
|
20
|
-
c: Math.floor(
|
|
21
|
-
h: Math.floor(
|
|
19
|
+
l: Math.floor(o.lch[0]),
|
|
20
|
+
c: Math.floor(o.lch[1]),
|
|
21
|
+
h: Math.floor(o.lch[2])
|
|
22
22
|
},
|
|
23
23
|
oklch: {
|
|
24
|
-
l: parseFloat(
|
|
25
|
-
c: parseFloat(
|
|
26
|
-
h: Math.floor(
|
|
24
|
+
l: parseFloat(o.oklch[0].toFixed(3)),
|
|
25
|
+
c: parseFloat(o.oklch[1].toFixed(3)),
|
|
26
|
+
h: Math.floor(o.oklch[2])
|
|
27
27
|
},
|
|
28
28
|
lab: {
|
|
29
|
-
l: Math.floor(
|
|
30
|
-
a: Math.floor(
|
|
31
|
-
b: Math.floor(
|
|
29
|
+
l: Math.floor(o.lab[0]),
|
|
30
|
+
a: Math.floor(o.lab[1]),
|
|
31
|
+
b: Math.floor(o.lab[2])
|
|
32
32
|
},
|
|
33
33
|
oklab: {
|
|
34
|
-
l: parseFloat(
|
|
35
|
-
a: parseFloat(
|
|
36
|
-
b: parseFloat(
|
|
34
|
+
l: parseFloat(o.oklab[0].toFixed(3)),
|
|
35
|
+
a: parseFloat(o.oklab[1].toFixed(3)),
|
|
36
|
+
b: parseFloat(o.oklab[2].toFixed(3))
|
|
37
37
|
},
|
|
38
38
|
hsl: {
|
|
39
|
-
h: Math.floor(
|
|
40
|
-
s: Math.floor(
|
|
41
|
-
l: Math.floor(
|
|
39
|
+
h: Math.floor(o.hsl[0]),
|
|
40
|
+
s: Math.floor(o.hsl[1] * 100),
|
|
41
|
+
l: Math.floor(o.hsl[2] * 100)
|
|
42
42
|
},
|
|
43
43
|
hsluv: {
|
|
44
|
-
h: Math.floor(
|
|
45
|
-
s: Math.floor(
|
|
46
|
-
l: Math.floor(
|
|
44
|
+
h: Math.floor(o.hsluv[0]),
|
|
45
|
+
s: Math.floor(o.hsluv[1]),
|
|
46
|
+
l: Math.floor(o.hsluv[2])
|
|
47
47
|
},
|
|
48
|
-
hex:
|
|
49
|
-
description:
|
|
48
|
+
hex: o.hex,
|
|
49
|
+
description: o.description,
|
|
50
50
|
type: "color shade/tint"
|
|
51
|
-
}), c = (
|
|
51
|
+
}), c = (o, 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: o.alpha,
|
|
94
|
+
description: o.description,
|
|
95
95
|
type: "color shade/tint"
|
|
96
96
|
});
|
|
97
|
-
return r[0].type === "custom theme" ? r.forEach((
|
|
98
|
-
n[
|
|
97
|
+
return r[0].type === "custom theme" ? r.forEach((o) => {
|
|
98
|
+
n[o.name] = {}, o.colors.forEach((e) => {
|
|
99
99
|
const t = e.shades.find(
|
|
100
100
|
(i) => i.type === "source color"
|
|
101
101
|
);
|
|
102
|
-
n[
|
|
103
|
-
i && t && (n[
|
|
104
|
-
}), n[
|
|
105
|
-
}), n[
|
|
106
|
-
}) : r.forEach((
|
|
107
|
-
|
|
102
|
+
n[o.name][e.name] = {}, e.shades.forEach((i) => {
|
|
103
|
+
i && t && (n[o.name][e.name][i.name] = i.isTransparent ? c(i, t) : a(i));
|
|
104
|
+
}), n[o.name][e.name].description = e.description, n[o.name][e.name].type = "color";
|
|
105
|
+
}), n[o.name].description = o.description, n[o.name].type = "color mode";
|
|
106
|
+
}) : r.forEach((o) => {
|
|
107
|
+
o.colors.forEach((e) => {
|
|
108
108
|
const t = e.shades.find(
|
|
109
109
|
(i) => i.type === "source color"
|
|
110
110
|
);
|
|
111
111
|
n[e.name] = {}, e.shades.forEach((i) => {
|
|
112
|
-
i && t && (n[e.name][i.name] = i.isTransparent ? c(i, t) :
|
|
112
|
+
i && t && (n[e.name][i.name] = i.isTransparent ? c(i, t) : a(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,18 +121,18 @@ class b {
|
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
123
|
const L = (m) => {
|
|
124
|
-
const r = m.themes.filter((
|
|
125
|
-
return r.forEach((
|
|
124
|
+
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 = [];
|
|
125
|
+
return r.forEach((a) => {
|
|
126
126
|
const c = [];
|
|
127
|
-
|
|
128
|
-
const e =
|
|
129
|
-
c.push(`// ${
|
|
127
|
+
a.colors.forEach((o) => {
|
|
128
|
+
const e = o.shades.find((t) => t.type === "source color");
|
|
129
|
+
c.push(`// ${o.name}`), o.shades.reverse().forEach((t) => {
|
|
130
130
|
c.push(
|
|
131
|
-
t.isTransparent ? `static let ${new b(
|
|
131
|
+
t.isTransparent ? `static let ${new b(o.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: ${t.alpha ?? 1})` : `static let ${new b(
|
|
135
|
+
)}, alpha: ${t.alpha ?? 1})` : `static let ${new b(o.name).doPascalCase()}${t.name === "source" ? "Source" : t.name} = UIColor(red: ${t.gl[0].toFixed(
|
|
136
136
|
3
|
|
137
137
|
)}, green: ${t.gl[1].toFixed(3)}, blue: ${t.gl[2].toFixed(
|
|
138
138
|
3
|
|
@@ -140,8 +140,8 @@ const L = (m) => {
|
|
|
140
140
|
);
|
|
141
141
|
}), c.push("");
|
|
142
142
|
}), c.pop(), r[0].type === "custom theme" ? n.push(
|
|
143
|
-
`// ${
|
|
144
|
-
struct ${new b(
|
|
143
|
+
`// ${a.name}
|
|
144
|
+
struct ${new b(a.name).doPascalCase()} {
|
|
145
145
|
${c.join(
|
|
146
146
|
`
|
|
147
147
|
`
|
|
@@ -157,65 +157,65 @@ struct Color {
|
|
|
157
157
|
`)}
|
|
158
158
|
}`;
|
|
159
159
|
}, H = (m) => {
|
|
160
|
-
const r = m.themes.filter((
|
|
160
|
+
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");
|
|
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((a) => {
|
|
168
|
+
a.colors.forEach((c) => {
|
|
169
|
+
const o = c.shades.find(
|
|
170
170
|
(l) => l.type === "source color"
|
|
171
171
|
), e = new b(c.name).doKebabCase();
|
|
172
172
|
n += ` /* ${c.name} */
|
|
173
173
|
`, c.shades.sort().forEach((l) => {
|
|
174
|
-
const h = l.isTransparent ? u((
|
|
174
|
+
const h = l.isTransparent ? u((o == null ? void 0 : o.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 t = c ===
|
|
178
|
+
const t = c === a.colors[a.colors.length - 1], i = a === r[r.length - 1];
|
|
179
179
|
t && i || (n += `
|
|
180
180
|
`);
|
|
181
181
|
});
|
|
182
|
-
}) : r.forEach((
|
|
183
|
-
const c = new b(
|
|
184
|
-
|
|
185
|
-
const e =
|
|
182
|
+
}) : r.forEach((a) => {
|
|
183
|
+
const c = new b(a.name).doKebabCase();
|
|
184
|
+
a.colors.forEach((o) => {
|
|
185
|
+
const e = o.shades.find(
|
|
186
186
|
(h) => h.type === "source color"
|
|
187
|
-
), t = new b(
|
|
188
|
-
n += ` /* ${
|
|
189
|
-
`,
|
|
190
|
-
const s = h.isTransparent ? u((e == null ? void 0 : e.hex) ?? "#000000").alpha(h.alpha ?? 1).hex() : h.hex,
|
|
191
|
-
n += ` --color-${c}-${t}-${
|
|
187
|
+
), t = new b(o.name).doKebabCase();
|
|
188
|
+
n += ` /* ${a.name} - ${o.name} */
|
|
189
|
+
`, o.shades.forEach((h) => {
|
|
190
|
+
const s = h.isTransparent ? u((e == null ? void 0 : e.hex) ?? "#000000").alpha(h.alpha ?? 1).hex() : h.hex, f = new b(h.name).doKebabCase();
|
|
191
|
+
n += ` --color-${c}-${t}-${f}: ${s};
|
|
192
192
|
`;
|
|
193
193
|
});
|
|
194
|
-
const i =
|
|
194
|
+
const i = o === a.colors[a.colors.length - 1], l = a === r[r.length - 1];
|
|
195
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((o) => o.type === "custom theme").length === 0 ? m.themes.filter((o) => o.type === "default theme") : m.themes.filter((o) => o.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
|
-
|
|
206
|
+
return m.themes[0].colors.forEach((o) => {
|
|
207
|
+
n.theme.colors[new b(o.name).doKebabCase()] = {};
|
|
208
|
+
}), r[0].type === "custom theme" ? r.forEach((o) => {
|
|
209
|
+
o.colors.forEach((e) => {
|
|
210
210
|
const t = e.shades.find(
|
|
211
211
|
(i) => i.type === "source color"
|
|
212
212
|
);
|
|
213
|
-
n.theme.colors[new b(e.name).doKebabCase()][new b(
|
|
214
|
-
n.theme.colors[new b(e.name).doKebabCase()][new b(
|
|
213
|
+
n.theme.colors[new b(e.name).doKebabCase()][new b(o.name).doKebabCase()] = {}, e.shades.forEach((i) => {
|
|
214
|
+
n.theme.colors[new b(e.name).doKebabCase()][new b(o.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
|
-
|
|
217
|
+
}) : r.forEach((o) => {
|
|
218
|
+
o.colors.forEach((e) => {
|
|
219
219
|
const t = e.shades.find(
|
|
220
220
|
(i) => i.type === "source color"
|
|
221
221
|
);
|
|
@@ -231,19 +231,19 @@ module.exports = ${JSON.stringify(
|
|
|
231
231
|
" "
|
|
232
232
|
)}`;
|
|
233
233
|
}, A = (m) => {
|
|
234
|
-
const r = m.themes.filter((
|
|
235
|
-
return r.forEach((
|
|
236
|
-
|
|
237
|
-
const
|
|
234
|
+
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 = [];
|
|
235
|
+
return r.forEach((a) => {
|
|
236
|
+
a.colors.forEach((c) => {
|
|
237
|
+
const o = c.shades.find((t) => t.type === "source color"), e = [];
|
|
238
238
|
e.push(
|
|
239
|
-
`// ${r[0].type === "custom theme" ?
|
|
239
|
+
`// ${r[0].type === "custom theme" ? a.name + " - " : ""}${c.name}`
|
|
240
240
|
), c.shades.reverse().forEach((t) => {
|
|
241
241
|
e.push(
|
|
242
|
-
t.isTransparent ? `public let ${r[0].type === "custom theme" ? new b(
|
|
242
|
+
t.isTransparent ? `public let ${r[0].type === "custom theme" ? new b(a.name + " " + c.name).doPascalCase() : new b(c.name).doPascalCase()}${t.name === "source" ? "Source" : t.name} = Color(red: ${o == null ? void 0 : o.gl[0].toFixed(
|
|
243
243
|
3
|
|
244
|
-
)}, green: ${
|
|
244
|
+
)}, green: ${o == null ? void 0 : o.gl[1].toFixed(3)}, blue: ${t.gl[2].toFixed(
|
|
245
245
|
3
|
|
246
|
-
)}).opacity(${t.alpha ?? 1})` : `public let ${r[0].type === "custom theme" ? new b(
|
|
246
|
+
)}).opacity(${t.alpha ?? 1})` : `public let ${r[0].type === "custom theme" ? new b(a.name + " " + c.name).doPascalCase() : new b(c.name).doPascalCase()}${t.name === "source" ? "Source" : t.name} = Color(red: ${t.gl[0].toFixed(
|
|
247
247
|
3
|
|
248
248
|
)}, green: ${t.gl[1].toFixed(3)}, blue: ${t.gl[2].toFixed(
|
|
249
249
|
3
|
|
@@ -265,41 +265,41 @@ public extension Color {
|
|
|
265
265
|
}, V = (m) => {
|
|
266
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 = {
|
|
267
267
|
color: {}
|
|
268
|
-
},
|
|
268
|
+
}, a = (c, o, e) => ({
|
|
269
269
|
type: "color",
|
|
270
|
-
value:
|
|
271
|
-
comment: c.description !== "" ? c.description + " - " +
|
|
270
|
+
value: o.isTransparent ? u(e.hex).alpha(o.alpha ?? 1).hex() : o.hex,
|
|
271
|
+
comment: c.description !== "" ? c.description + " - " + o.description : o.description
|
|
272
272
|
});
|
|
273
273
|
return m.themes[0].colors.forEach((c) => {
|
|
274
274
|
n.color[c.name] = {};
|
|
275
275
|
}), r[0].type === "custom theme" ? r.forEach((c) => {
|
|
276
|
-
c.colors.forEach((
|
|
277
|
-
const e =
|
|
276
|
+
c.colors.forEach((o) => {
|
|
277
|
+
const e = o.shades.find(
|
|
278
278
|
(t) => t.type === "source color"
|
|
279
279
|
);
|
|
280
|
-
n.color[
|
|
281
|
-
t && e && (n.color[
|
|
282
|
-
|
|
280
|
+
n.color[o.name][c.name] = {}, o.shades.forEach((t) => {
|
|
281
|
+
t && e && (n.color[o.name][c.name][t.name] = a(
|
|
282
|
+
o,
|
|
283
283
|
t,
|
|
284
284
|
e
|
|
285
285
|
));
|
|
286
286
|
});
|
|
287
287
|
});
|
|
288
288
|
}) : r.forEach((c) => {
|
|
289
|
-
c.colors.forEach((
|
|
290
|
-
const e =
|
|
289
|
+
c.colors.forEach((o) => {
|
|
290
|
+
const e = o.shades.find(
|
|
291
291
|
(t) => t.type === "source color"
|
|
292
292
|
);
|
|
293
|
-
n.color[
|
|
294
|
-
t && e && (n.color[
|
|
293
|
+
n.color[o.name] = {}, o.shades.forEach((t) => {
|
|
294
|
+
t && e && (n.color[o.name][t.name] = a(o, t, e));
|
|
295
295
|
});
|
|
296
296
|
});
|
|
297
297
|
}), JSON.stringify(n, null, " ");
|
|
298
298
|
}, P = (m, r) => {
|
|
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"),
|
|
300
|
-
var
|
|
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"), a = [], c = [], o = (s) => {
|
|
300
|
+
var p;
|
|
301
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);
|
|
302
|
-
const
|
|
302
|
+
const f = {
|
|
303
303
|
RGB: () => `rgb(${Math.floor(s.rgb[0])}, ${Math.floor(
|
|
304
304
|
s.rgb[1]
|
|
305
305
|
)}, ${Math.floor(s.rgb[2])})`,
|
|
@@ -312,120 +312,120 @@ public extension Color {
|
|
|
312
312
|
)} ${Math.floor(s.lch[2])})`,
|
|
313
313
|
OKLCH: () => `oklch(${Math.floor(s.oklch[0] * 100)}% ${s.oklch[1].toFixed(3)} ${Math.floor(s.oklch[2])})`
|
|
314
314
|
};
|
|
315
|
-
return (
|
|
316
|
-
}, e = (s,
|
|
315
|
+
return (p = f[r ?? "RGB"]) == null ? void 0 : p.call(f);
|
|
316
|
+
}, e = (s, f) => {
|
|
317
317
|
var $;
|
|
318
318
|
isNaN(s.hsl[0]) && (s.hsl[0] = 0), isNaN(s.lch[2]) && (s.lch[2] = 0), isNaN(s.oklch[2]) && (s.oklch[2] = 0);
|
|
319
|
-
const
|
|
319
|
+
const p = {
|
|
320
320
|
RGB: () => {
|
|
321
321
|
var g;
|
|
322
|
-
return `rgba(${Math.floor(
|
|
323
|
-
|
|
324
|
-
)}, ${Math.floor(
|
|
322
|
+
return `rgba(${Math.floor(f.rgb[0])}, ${Math.floor(
|
|
323
|
+
f.rgb[1]
|
|
324
|
+
)}, ${Math.floor(f.rgb[2])}, ${((g = s.alpha) == null ? void 0 : g.toFixed(2)) ?? 1})`;
|
|
325
325
|
},
|
|
326
|
-
HEX: () => u(
|
|
326
|
+
HEX: () => u(f.hex).alpha(s.alpha ?? 1).hex(),
|
|
327
327
|
HSL: () => {
|
|
328
328
|
var g;
|
|
329
|
-
return `hsla(${Math.floor(
|
|
330
|
-
|
|
331
|
-
)}%, ${Math.floor(
|
|
329
|
+
return `hsla(${Math.floor(f.hsl[0])} ${Math.floor(
|
|
330
|
+
f.hsl[1] * 100
|
|
331
|
+
)}%, ${Math.floor(f.hsl[2] * 100)}% ${((g = s.alpha) == null ? void 0 : g.toFixed(2)) ?? 1})`;
|
|
332
332
|
},
|
|
333
333
|
LCH: () => {
|
|
334
334
|
var g;
|
|
335
|
-
return `lch(${Math.floor(
|
|
336
|
-
|
|
337
|
-
)} ${Math.floor(
|
|
335
|
+
return `lch(${Math.floor(f.lch[0])}% ${Math.floor(
|
|
336
|
+
f.lch[1]
|
|
337
|
+
)} ${Math.floor(f.lch[2])} / ${((g = s.alpha) == null ? void 0 : g.toFixed(2)) ?? 1})`;
|
|
338
338
|
},
|
|
339
339
|
OKLCH: () => {
|
|
340
340
|
var g;
|
|
341
|
-
return `oklch(${Math.floor(
|
|
341
|
+
return `oklch(${Math.floor(f.oklch[0 * 100])}% ${f.oklch[1].toFixed(3)} ${Math.floor(f.oklch[2])} / ${((g = s.alpha) == null ? void 0 : g.toFixed(2)) ?? 1})`;
|
|
342
342
|
}
|
|
343
343
|
};
|
|
344
|
-
return ($ =
|
|
344
|
+
return ($ = p[r ?? "RGB"]) == null ? void 0 : $.call(p);
|
|
345
345
|
}, t = n.find(
|
|
346
346
|
(s) => s.type === "default theme"
|
|
347
347
|
);
|
|
348
348
|
if (t) {
|
|
349
349
|
const s = [];
|
|
350
|
-
return t.colors.forEach((
|
|
351
|
-
|
|
352
|
-
const g =
|
|
350
|
+
return t.colors.forEach((f, p) => {
|
|
351
|
+
p > 0 && s.push(""), s.push(`// ${f.name}`), f.shades.reverse().forEach(($) => {
|
|
352
|
+
const g = f.shades.find((C) => C.type === "source color"), d = `$${new b(f.name).doKebabCase()}-${$.name}`;
|
|
353
353
|
g && s.push(
|
|
354
|
-
`${d}: ${$.isTransparent ? e($, g) :
|
|
354
|
+
`${d}: ${$.isTransparent ? e($, g) : o($)};`
|
|
355
355
|
);
|
|
356
356
|
});
|
|
357
|
-
}),
|
|
358
|
-
`)),
|
|
357
|
+
}), a.push(s.join(`
|
|
358
|
+
`)), a.join(`
|
|
359
359
|
`);
|
|
360
360
|
}
|
|
361
361
|
n.forEach((s) => {
|
|
362
|
-
const
|
|
363
|
-
|
|
364
|
-
g > 0 &&
|
|
362
|
+
const f = new b(s.name).doKebabCase(), p = [];
|
|
363
|
+
p.push(`// ${s.name}`), p.push(`@mixin ${f} {`), s.colors.forEach(($, g) => {
|
|
364
|
+
g > 0 && p.push(""), p.push(` // ${$.name}`), $.shades.reverse().forEach((d) => {
|
|
365
365
|
const C = $.shades.find((F) => F.type === "source color"), E = `--${new b($.name).doKebabCase()}-${d.name}`;
|
|
366
|
-
C &&
|
|
367
|
-
` ${E}: ${d.isTransparent ? e(d, C) :
|
|
366
|
+
C && p.push(
|
|
367
|
+
` ${E}: ${d.isTransparent ? e(d, C) : o(d)};`
|
|
368
368
|
);
|
|
369
369
|
});
|
|
370
|
-
}),
|
|
370
|
+
}), p.push("}"), a.push(p.join(`
|
|
371
371
|
`));
|
|
372
372
|
});
|
|
373
373
|
const i = /* @__PURE__ */ new Set();
|
|
374
374
|
if (n.forEach((s) => {
|
|
375
|
-
s.colors.forEach((
|
|
376
|
-
|
|
377
|
-
if (
|
|
378
|
-
const d = `--${new b(
|
|
375
|
+
s.colors.forEach((f) => {
|
|
376
|
+
f.shades.forEach((p) => {
|
|
377
|
+
if (f.shades.find((g) => g.type === "source color")) {
|
|
378
|
+
const d = `--${new b(f.name).doKebabCase()}-${p.name}`;
|
|
379
379
|
i.add(d);
|
|
380
380
|
}
|
|
381
381
|
});
|
|
382
382
|
});
|
|
383
383
|
}), i.size > 0) {
|
|
384
384
|
const s = /* @__PURE__ */ new Map();
|
|
385
|
-
i.forEach((
|
|
386
|
-
const
|
|
387
|
-
if (
|
|
388
|
-
const $ =
|
|
385
|
+
i.forEach((f) => {
|
|
386
|
+
const p = f.match(/--([a-zA-Z0-9-]+)-([a-zA-Z0-9-]+)/);
|
|
387
|
+
if (p) {
|
|
388
|
+
const $ = p[1];
|
|
389
389
|
s.has($) || s.set($, []);
|
|
390
|
-
const g = `$${
|
|
391
|
-
s.get($).push(`${g}: var(${
|
|
390
|
+
const g = `$${f.substring(2)}`;
|
|
391
|
+
s.get($).push(`${g}: var(${f});`);
|
|
392
392
|
}
|
|
393
|
-
}), s.forEach((
|
|
393
|
+
}), s.forEach((f, p) => {
|
|
394
394
|
c.push(
|
|
395
|
-
`// ${
|
|
396
|
-
), c.push(...
|
|
397
|
-
}), c.length > 0 && c[c.length - 1] === "" && c.pop(),
|
|
395
|
+
`// ${p.charAt(0).toUpperCase() + p.slice(1)}`
|
|
396
|
+
), c.push(...f), c.push("");
|
|
397
|
+
}), c.length > 0 && c[c.length - 1] === "" && c.pop(), a.push(c.join(`
|
|
398
398
|
`));
|
|
399
399
|
}
|
|
400
400
|
const l = [":root {"];
|
|
401
|
-
n.forEach((s,
|
|
402
|
-
const
|
|
403
|
-
l.push(` &[data-theme="${
|
|
404
|
-
@include ${
|
|
405
|
-
}`),
|
|
406
|
-
}), l.push("}"),
|
|
401
|
+
n.forEach((s, f) => {
|
|
402
|
+
const p = new b(s.name).doKebabCase();
|
|
403
|
+
l.push(` &[data-theme="${p}"] {
|
|
404
|
+
@include ${p};
|
|
405
|
+
}`), f !== n.length - 1 && l.push("");
|
|
406
|
+
}), l.push("}"), a.push(l.join(`
|
|
407
407
|
`));
|
|
408
408
|
const h = [];
|
|
409
409
|
return n.forEach((s) => {
|
|
410
|
-
const
|
|
411
|
-
h.push(`.${
|
|
412
|
-
@include ${
|
|
410
|
+
const f = new b(s.name).doKebabCase();
|
|
411
|
+
h.push(`.${f} {
|
|
412
|
+
@include ${f};
|
|
413
413
|
}`);
|
|
414
|
-
}),
|
|
414
|
+
}), a.push(h.join(`
|
|
415
415
|
|
|
416
|
-
`)),
|
|
416
|
+
`)), a.join(`
|
|
417
417
|
|
|
418
418
|
`);
|
|
419
419
|
}, j = (m) => {
|
|
420
|
-
const r = m.themes.filter((
|
|
421
|
-
return r.forEach((
|
|
422
|
-
|
|
423
|
-
const
|
|
420
|
+
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 = [];
|
|
421
|
+
return r.forEach((a) => {
|
|
422
|
+
a.colors.forEach((c) => {
|
|
423
|
+
const o = c.shades.find((t) => t.type === "source color"), e = [];
|
|
424
424
|
e.push(
|
|
425
|
-
`<!--${r[0].type === "custom theme" ? `${
|
|
425
|
+
`<!--${r[0].type === "custom theme" ? `${a.name} - ${c.name}-->` : `${c.name}-->`}`
|
|
426
426
|
), c.shades.reverse().forEach((t) => {
|
|
427
427
|
e.push(
|
|
428
|
-
`<color name="${r[0].type === "custom theme" ? new b(
|
|
428
|
+
`<color name="${r[0].type === "custom theme" ? new b(a.name + " " + c.name).doSnakeCase() : new b(c.name).doSnakeCase()}_${t.name}">${t.isTransparent ? u((o == null ? void 0 : o.hex) ?? "#000000").alpha(t.alpha ?? 1).hex() : t.hex}</color>`
|
|
429
429
|
);
|
|
430
430
|
}), e.push(""), e.forEach((t) => n.push(t));
|
|
431
431
|
});
|
|
@@ -437,38 +437,38 @@ public extension Color {
|
|
|
437
437
|
)}
|
|
438
438
|
</resources>`;
|
|
439
439
|
}, B = (m) => {
|
|
440
|
-
const r = m.themes.filter((
|
|
440
|
+
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 = {
|
|
441
441
|
$themes: [],
|
|
442
442
|
$metadata: {
|
|
443
443
|
activeThemes: [],
|
|
444
444
|
tokenSetOrder: [],
|
|
445
445
|
activeSets: []
|
|
446
446
|
}
|
|
447
|
-
},
|
|
447
|
+
}, a = m.name, c = (o, e, t) => ({
|
|
448
448
|
$type: "color",
|
|
449
449
|
$value: e.isTransparent ? u(t.hex).alpha(e.alpha ?? 1).hex() : e.hex,
|
|
450
|
-
$description:
|
|
450
|
+
$description: o.description !== "" ? o.description + " - " + e.description : e.description
|
|
451
451
|
});
|
|
452
|
-
return r[0].type === "custom theme" ? r.forEach((
|
|
453
|
-
|
|
452
|
+
return r[0].type === "custom theme" ? r.forEach((o) => {
|
|
453
|
+
o.colors.forEach((e) => {
|
|
454
454
|
const t = e.shades.find(
|
|
455
455
|
(i) => i.type === "source color"
|
|
456
456
|
);
|
|
457
|
-
n[`${
|
|
458
|
-
i && t && (n[`${
|
|
457
|
+
n[`${o.name}/${e.name}`] = {}, e.shades.forEach((i) => {
|
|
458
|
+
i && t && (n[`${o.name}/${e.name}`][i.name] = c(
|
|
459
459
|
e,
|
|
460
460
|
i,
|
|
461
461
|
t
|
|
462
462
|
));
|
|
463
463
|
});
|
|
464
464
|
});
|
|
465
|
-
}) : r.forEach((
|
|
466
|
-
|
|
465
|
+
}) : r.forEach((o) => {
|
|
466
|
+
o.colors.forEach((e) => {
|
|
467
467
|
const t = e.shades.find(
|
|
468
468
|
(i) => i.type === "source color"
|
|
469
469
|
);
|
|
470
|
-
n[`${
|
|
471
|
-
i && t && (n[`${
|
|
470
|
+
n[`${a}/${e.name}`] = {}, e.shades.forEach((i) => {
|
|
471
|
+
i && t && (n[`${a}/${e.name}`][i.name] = c(
|
|
472
472
|
e,
|
|
473
473
|
i,
|
|
474
474
|
t
|
|
@@ -477,7 +477,7 @@ public extension Color {
|
|
|
477
477
|
});
|
|
478
478
|
}), JSON.stringify(n, null, " ");
|
|
479
479
|
}, R = (m, r) => {
|
|
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"),
|
|
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"), a = [], c = (l) => {
|
|
481
481
|
var s;
|
|
482
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);
|
|
483
483
|
const h = {
|
|
@@ -494,61 +494,61 @@ public extension Color {
|
|
|
494
494
|
OKLCH: () => `oklch(${Math.floor(l.oklch[0] * 100)}% ${l.oklch[1].toFixed(3)} ${Math.floor(l.oklch[2])})`
|
|
495
495
|
};
|
|
496
496
|
return (s = h[r ?? "RGB"]) == null ? void 0 : s.call(h);
|
|
497
|
-
},
|
|
498
|
-
var
|
|
497
|
+
}, o = (l, h) => {
|
|
498
|
+
var f;
|
|
499
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);
|
|
500
500
|
const s = {
|
|
501
501
|
RGB: () => {
|
|
502
|
-
var
|
|
502
|
+
var p;
|
|
503
503
|
return `rgba(${Math.floor(h.rgb[0])}, ${Math.floor(
|
|
504
504
|
h.rgb[1]
|
|
505
|
-
)}, ${Math.floor(h.rgb[2])}, ${((
|
|
505
|
+
)}, ${Math.floor(h.rgb[2])}, ${((p = l.alpha) == null ? void 0 : p.toFixed(2)) ?? 1})`;
|
|
506
506
|
},
|
|
507
507
|
HEX: () => u(h.hex).alpha(l.alpha ?? 1).hex(),
|
|
508
508
|
HSL: () => {
|
|
509
|
-
var
|
|
509
|
+
var p;
|
|
510
510
|
return `hsla(${Math.floor(h.hsl[0])}, ${Math.floor(
|
|
511
511
|
h.hsl[1] * 100
|
|
512
|
-
)}% ${Math.floor(h.hsl[2] * 100)}% ${((
|
|
512
|
+
)}% ${Math.floor(h.hsl[2] * 100)}% ${((p = l.alpha) == null ? void 0 : p.toFixed(2)) ?? 1})`;
|
|
513
513
|
},
|
|
514
514
|
LCH: () => {
|
|
515
|
-
var
|
|
515
|
+
var p;
|
|
516
516
|
return `lch(${Math.floor(h.lch[0])}% ${Math.floor(
|
|
517
517
|
h.lch[1]
|
|
518
|
-
)} ${Math.floor(h.lch[2])} / ${((
|
|
518
|
+
)} ${Math.floor(h.lch[2])} / ${((p = l.alpha) == null ? void 0 : p.toFixed(2)) ?? 1})`;
|
|
519
519
|
},
|
|
520
520
|
OKLCH: () => {
|
|
521
|
-
var
|
|
522
|
-
return `oklch(${Math.floor(h.oklch[0] * 100)}% ${h.oklch[1].toFixed(3)} ${Math.floor(h.oklch[2])} / ${((
|
|
521
|
+
var p;
|
|
522
|
+
return `oklch(${Math.floor(h.oklch[0] * 100)}% ${h.oklch[1].toFixed(3)} ${Math.floor(h.oklch[2])} / ${((p = l.alpha) == null ? void 0 : p.toFixed(2)) ?? 1})`;
|
|
523
523
|
}
|
|
524
524
|
};
|
|
525
|
-
return (
|
|
525
|
+
return (f = s[r ?? "RGB"]) == null ? void 0 : f.call(s);
|
|
526
526
|
}, e = n.find(
|
|
527
527
|
(l) => l.type === "default theme"
|
|
528
528
|
);
|
|
529
529
|
if (e) {
|
|
530
530
|
const l = [];
|
|
531
531
|
return e.colors.forEach((h, s) => {
|
|
532
|
-
s > 0 && l.push(""), l.push(`// ${h.name}`), h.shades.reverse().forEach((
|
|
533
|
-
const
|
|
534
|
-
|
|
535
|
-
`${$}: ${
|
|
532
|
+
s > 0 && l.push(""), l.push(`// ${h.name}`), h.shades.reverse().forEach((f) => {
|
|
533
|
+
const p = h.shades.find((g) => g.type === "source color"), $ = `@${new b(h.name).doKebabCase()}-${f.name}`;
|
|
534
|
+
p && l.push(
|
|
535
|
+
`${$}: ${f.isTransparent ? o(f, p) : c(f)};`
|
|
536
536
|
);
|
|
537
537
|
});
|
|
538
|
-
}),
|
|
539
|
-
`)),
|
|
538
|
+
}), a.push(l.join(`
|
|
539
|
+
`)), a.join(`
|
|
540
540
|
`);
|
|
541
541
|
}
|
|
542
542
|
n.forEach((l) => {
|
|
543
543
|
const h = new b(l.name).doKebabCase(), s = [];
|
|
544
|
-
s.push(`// ${l.name}`), s.push(`.${h}() {`), l.colors.forEach((
|
|
545
|
-
|
|
546
|
-
const g =
|
|
544
|
+
s.push(`// ${l.name}`), s.push(`.${h}() {`), l.colors.forEach((f, p) => {
|
|
545
|
+
p > 0 && s.push(""), s.push(` // ${f.name}`), f.shades.reverse().forEach(($) => {
|
|
546
|
+
const g = f.shades.find((C) => C.type === "source color"), d = `@${new b(f.name).doKebabCase()}-${$.name}`;
|
|
547
547
|
g && s.push(
|
|
548
|
-
` ${d}: ${$.isTransparent ?
|
|
548
|
+
` ${d}: ${$.isTransparent ? o($, g) : c($)};`
|
|
549
549
|
);
|
|
550
550
|
});
|
|
551
|
-
}), s.push("}"),
|
|
551
|
+
}), s.push("}"), a.push(s.join(`
|
|
552
552
|
`));
|
|
553
553
|
});
|
|
554
554
|
const t = [":root {"];
|
|
@@ -557,7 +557,7 @@ public extension Color {
|
|
|
557
557
|
t.push(` &[data-theme="${s}"] {
|
|
558
558
|
.${s}();
|
|
559
559
|
}`), h !== n.length - 1 && t.push("");
|
|
560
|
-
}), t.push("}"),
|
|
560
|
+
}), t.push("}"), a.push(t.join(`
|
|
561
561
|
`));
|
|
562
562
|
const i = [];
|
|
563
563
|
return n.forEach((l) => {
|
|
@@ -565,13 +565,13 @@ public extension Color {
|
|
|
565
565
|
i.push(`.${h} {
|
|
566
566
|
.${h}();
|
|
567
567
|
}`);
|
|
568
|
-
}),
|
|
568
|
+
}), a.push(i.join(`
|
|
569
569
|
|
|
570
|
-
`)),
|
|
570
|
+
`)), a.join(`
|
|
571
571
|
|
|
572
572
|
`);
|
|
573
573
|
}, G = (m, r) => {
|
|
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"),
|
|
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"), a = {}, c = (e) => {
|
|
575
575
|
var i;
|
|
576
576
|
isNaN(e.oklch[2]) && (e.oklch[2] = 0);
|
|
577
577
|
const t = {
|
|
@@ -595,7 +595,7 @@ public extension Color {
|
|
|
595
595
|
})
|
|
596
596
|
};
|
|
597
597
|
return (i = t[r ?? "RGB"]) == null ? void 0 : i.call(t);
|
|
598
|
-
},
|
|
598
|
+
}, o = (e, t) => {
|
|
599
599
|
var l;
|
|
600
600
|
isNaN(t.oklch[2]) && (t.oklch[2] = 0);
|
|
601
601
|
const i = {
|
|
@@ -627,17 +627,17 @@ public extension Color {
|
|
|
627
627
|
const i = t.shades.find(
|
|
628
628
|
(l) => l.type === "source color"
|
|
629
629
|
);
|
|
630
|
-
|
|
630
|
+
a[t.name] || (a[t.name] = {
|
|
631
631
|
$type: "color"
|
|
632
632
|
}), t.shades.forEach((l) => {
|
|
633
|
-
!
|
|
633
|
+
!a[t.name][l.name] && i && (a[t.name][l.name] = {
|
|
634
634
|
$type: "color",
|
|
635
|
-
$value: l.isTransparent ?
|
|
635
|
+
$value: l.isTransparent ? o(i, l) : c(l),
|
|
636
636
|
$description: t.description !== "" ? t.description + " - " + l.description : l.description,
|
|
637
637
|
$extensions: {
|
|
638
638
|
mode: {}
|
|
639
639
|
}
|
|
640
|
-
}), i && (
|
|
640
|
+
}), i && (a[t.name][l.name].$extensions.mode[e.name] = l.isTransparent ? o(i, l) : c(l));
|
|
641
641
|
});
|
|
642
642
|
});
|
|
643
643
|
}) : n.forEach((e) => {
|
|
@@ -645,37 +645,37 @@ public extension Color {
|
|
|
645
645
|
const i = t.shades.find(
|
|
646
646
|
(l) => l.type === "source color"
|
|
647
647
|
);
|
|
648
|
-
|
|
649
|
-
l && i && (
|
|
648
|
+
a[t.name] = {}, t.shades.forEach((l) => {
|
|
649
|
+
l && i && (a[t.name][l.name] = {
|
|
650
650
|
$type: "color",
|
|
651
|
-
$value: l.isTransparent ?
|
|
651
|
+
$value: l.isTransparent ? o(i, l) : c(l),
|
|
652
652
|
$description: t.description !== "" ? t.description + " - " + l.description : l.description
|
|
653
653
|
});
|
|
654
654
|
});
|
|
655
655
|
});
|
|
656
|
-
}), JSON.stringify(
|
|
656
|
+
}), JSON.stringify(a, null, " ");
|
|
657
657
|
}, O = (m) => {
|
|
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 = [],
|
|
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 = [], a = [], c = [], o = [], e = [], t = [];
|
|
659
659
|
return r.forEach((i) => {
|
|
660
660
|
i.colors.forEach((l) => {
|
|
661
661
|
l.shades.forEach((h) => {
|
|
662
|
-
c.push(h.name),
|
|
662
|
+
c.push(h.name), o.push(Math.floor(h.lch[0])), e.push(Math.floor(h.lch[1])), t.push(Math.floor(h.lch[2]));
|
|
663
663
|
}), n.push({
|
|
664
664
|
name: l.name,
|
|
665
665
|
csv: `${l.name},Lightness,Chroma,Hue
|
|
666
|
-
${c.map((h, s) => `${h},${
|
|
666
|
+
${c.map((h, s) => `${h},${o[s]},${e[s]},${t[s]}`).join(`
|
|
667
667
|
`)}`
|
|
668
|
-
}), c.splice(0, c.length),
|
|
669
|
-
}),
|
|
668
|
+
}), c.splice(0, c.length), o.splice(0, o.length), e.splice(0, e.length), t.splice(0, t.length);
|
|
669
|
+
}), a.push({
|
|
670
670
|
name: i.name,
|
|
671
671
|
colors: n.map((l) => l),
|
|
672
672
|
type: i.type
|
|
673
673
|
}), n.splice(0, n.length);
|
|
674
|
-
}),
|
|
674
|
+
}), a;
|
|
675
675
|
}, _ = (m, r) => {
|
|
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"),
|
|
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"), a = [], c = (e) => {
|
|
677
677
|
var i;
|
|
678
|
-
isNaN(e.hsl[0]) && (e.hsl[0] = 0), isNaN(e.lch[2]) && (e.lch[2] = 0);
|
|
678
|
+
isNaN(e.hsl[0]) && (e.hsl[0] = 0), isNaN(e.lch[2]) && (e.lch[2] = 0), isNaN(e.oklch[2]) && (e.oklch[2] = 0);
|
|
679
679
|
const t = {
|
|
680
680
|
RGB: () => `rgb(${Math.floor(e.rgb[0])}, ${Math.floor(
|
|
681
681
|
e.rgb[1]
|
|
@@ -693,8 +693,9 @@ ${c.map((h, s) => `${h},${a[s]},${e[s]},${t[s]}`).join(`
|
|
|
693
693
|
)} ${e.gl[2].toFixed(3)})`
|
|
694
694
|
};
|
|
695
695
|
return (i = t[r ?? "RGB"]) == null ? void 0 : i.call(t);
|
|
696
|
-
},
|
|
696
|
+
}, o = (e, t) => {
|
|
697
697
|
var l;
|
|
698
|
+
isNaN(e.hsl[0]) && (e.hsl[0] = 0), isNaN(e.lch[2]) && (e.lch[2] = 0), isNaN(e.oklch[2]) && (e.oklch[2] = 0);
|
|
698
699
|
const i = {
|
|
699
700
|
RGB: () => {
|
|
700
701
|
var h;
|
|
@@ -717,7 +718,7 @@ ${c.map((h, s) => `${h},${a[s]},${e[s]},${t[s]}`).join(`
|
|
|
717
718
|
},
|
|
718
719
|
OKLCH: () => {
|
|
719
720
|
var h;
|
|
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})`;
|
|
721
|
+
return `oklch(${Math.floor(t.oklch[0 * 100])}% ${t.oklch[1].toFixed(3)} ${Math.floor(t.oklch[2])} / ${((h = e.alpha) == null ? void 0 : h.toFixed(2)) ?? 1})`;
|
|
721
722
|
},
|
|
722
723
|
P3: () => {
|
|
723
724
|
var h;
|
|
@@ -734,29 +735,29 @@ ${c.map((h, s) => `${h},${a[s]},${e[s]},${t[s]}`).join(`
|
|
|
734
735
|
t.push(`/* ${i.name} */`), i.shades.reverse().forEach((l) => {
|
|
735
736
|
const h = i.shades.find((s) => s.type === "source color");
|
|
736
737
|
h && t.push(
|
|
737
|
-
`--${new b(i.name).doKebabCase()}-${l.name}: ${l.isTransparent ?
|
|
738
|
+
`--${new b(i.name).doKebabCase()}-${l.name}: ${l.isTransparent ? o(l, h) : c(l)};`
|
|
738
739
|
);
|
|
739
740
|
}), t.push("");
|
|
740
|
-
}), t.pop(),
|
|
741
|
+
}), t.pop(), a.push(
|
|
741
742
|
`${e.type === "custom theme" ? `/* ${e.name} */
|
|
742
743
|
` : ""}:root${e.type === "custom theme" ? `[data-theme='${new b(e.name).doKebabCase()}']` : ""} {
|
|
743
744
|
${t.join(`
|
|
744
745
|
`)}
|
|
745
746
|
}`
|
|
746
747
|
);
|
|
747
|
-
}),
|
|
748
|
+
}), a.join(`
|
|
748
749
|
|
|
749
750
|
`);
|
|
750
751
|
}, U = (m) => {
|
|
751
|
-
const r = m.themes.filter((
|
|
752
|
-
return r.forEach((
|
|
753
|
-
|
|
754
|
-
const
|
|
752
|
+
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 = [];
|
|
753
|
+
return r.forEach((a) => {
|
|
754
|
+
a.colors.forEach((c) => {
|
|
755
|
+
const o = c.shades.find((t) => t.type === "source color"), e = [];
|
|
755
756
|
e.push(
|
|
756
|
-
`// ${r[0].type === "custom theme" ?
|
|
757
|
+
`// ${r[0].type === "custom theme" ? a.name + " - " : ""}${c.name}`
|
|
757
758
|
), c.shades.reverse().forEach((t) => {
|
|
758
759
|
e.push(
|
|
759
|
-
`val ${r[0].type === "custom theme" ? new b(
|
|
760
|
+
`val ${r[0].type === "custom theme" ? new b(a.name + " " + c.name).doSnakeCase() : new b(c.name).doSnakeCase()}_${t.name} = Color(${t.isTransparent ? u((o == null ? void 0 : o.hex) ?? "#000000").alpha(t.alpha ?? 1).hex().replace("#", "0xFF").toUpperCase() : t.hex.replace("#", "0xFF").toUpperCase()})`
|
|
760
761
|
);
|
|
761
762
|
}), e.push(""), e.forEach((t) => n.push(t));
|
|
762
763
|
});
|
|
@@ -769,7 +770,7 @@ class J {
|
|
|
769
770
|
constructor({
|
|
770
771
|
base: r,
|
|
771
772
|
themes: n,
|
|
772
|
-
meta:
|
|
773
|
+
meta: a
|
|
773
774
|
}) {
|
|
774
775
|
k(this, "base");
|
|
775
776
|
k(this, "themes");
|
|
@@ -784,24 +785,24 @@ class J {
|
|
|
784
785
|
colors: [],
|
|
785
786
|
type: r.type
|
|
786
787
|
};
|
|
787
|
-
this.base.colors.forEach((
|
|
788
|
+
this.base.colors.forEach((a) => {
|
|
788
789
|
const c = Object.entries(r.scale).reverse().map((h) => {
|
|
789
|
-
if (
|
|
790
|
+
if (a.alpha.isEnabled) {
|
|
790
791
|
const s = new x({
|
|
791
792
|
render: "RGB",
|
|
792
793
|
sourceColor: [
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
794
|
+
a.rgb.r * 255,
|
|
795
|
+
a.rgb.g * 255,
|
|
796
|
+
a.rgb.b * 255
|
|
796
797
|
],
|
|
797
798
|
alpha: parseFloat((h[1] / 100).toFixed(2)),
|
|
798
|
-
hueShifting:
|
|
799
|
-
chromaShifting:
|
|
799
|
+
hueShifting: a.hue.shift !== void 0 ? a.hue.shift : 0,
|
|
800
|
+
chromaShifting: a.chroma.shift !== void 0 ? a.chroma.shift : 100,
|
|
800
801
|
algorithmVersion: this.base.algorithmVersion,
|
|
801
802
|
visionSimulationMode: r.visionSimulationMode
|
|
802
|
-
}),
|
|
803
|
+
}), f = new x({
|
|
803
804
|
render: "RGB",
|
|
804
|
-
sourceColor: u(
|
|
805
|
+
sourceColor: u(a.alpha.backgroundColor).rgb(),
|
|
805
806
|
algorithmVersion: this.base.algorithmVersion,
|
|
806
807
|
visionSimulationMode: r.visionSimulationMode
|
|
807
808
|
});
|
|
@@ -810,61 +811,61 @@ class J {
|
|
|
810
811
|
return this.base.areSourceColorsLocked ? [
|
|
811
812
|
h,
|
|
812
813
|
s.setColorWithAlpha(),
|
|
813
|
-
|
|
814
|
+
f.setColorWithAlpha()
|
|
814
815
|
] : [
|
|
815
816
|
h,
|
|
816
817
|
s.lcha(),
|
|
817
|
-
|
|
818
|
+
f.lcha()
|
|
818
819
|
];
|
|
819
820
|
case "OKLCH":
|
|
820
821
|
return this.base.areSourceColorsLocked ? [
|
|
821
822
|
h,
|
|
822
823
|
s.setColorWithAlpha(),
|
|
823
|
-
|
|
824
|
+
f.setColorWithAlpha()
|
|
824
825
|
] : [
|
|
825
826
|
h,
|
|
826
827
|
s.oklcha(),
|
|
827
|
-
|
|
828
|
+
f.oklcha()
|
|
828
829
|
];
|
|
829
830
|
case "LAB":
|
|
830
831
|
return this.base.areSourceColorsLocked ? [
|
|
831
832
|
h,
|
|
832
833
|
s.setColorWithAlpha(),
|
|
833
|
-
|
|
834
|
+
f.setColorWithAlpha()
|
|
834
835
|
] : [
|
|
835
836
|
h,
|
|
836
837
|
s.laba(),
|
|
837
|
-
|
|
838
|
+
f.laba()
|
|
838
839
|
];
|
|
839
840
|
case "OKLAB":
|
|
840
841
|
return this.base.areSourceColorsLocked ? [
|
|
841
842
|
h,
|
|
842
843
|
s.setColorWithAlpha(),
|
|
843
|
-
|
|
844
|
+
f.setColorWithAlpha()
|
|
844
845
|
] : [
|
|
845
846
|
h,
|
|
846
847
|
s.oklaba(),
|
|
847
|
-
|
|
848
|
+
f.oklaba()
|
|
848
849
|
];
|
|
849
850
|
case "HSL":
|
|
850
851
|
return this.base.areSourceColorsLocked ? [
|
|
851
852
|
h,
|
|
852
853
|
s.setColorWithAlpha(),
|
|
853
|
-
|
|
854
|
+
f.setColorWithAlpha()
|
|
854
855
|
] : [
|
|
855
856
|
h,
|
|
856
857
|
s.hsla(),
|
|
857
|
-
|
|
858
|
+
f.hsla()
|
|
858
859
|
];
|
|
859
860
|
case "HSLUV":
|
|
860
861
|
return this.base.areSourceColorsLocked ? [
|
|
861
862
|
h,
|
|
862
863
|
s.setColorWithAlpha(),
|
|
863
|
-
|
|
864
|
+
f.setColorWithAlpha()
|
|
864
865
|
] : [
|
|
865
866
|
h,
|
|
866
867
|
s.hsluva(),
|
|
867
|
-
|
|
868
|
+
f.hsluva()
|
|
868
869
|
];
|
|
869
870
|
default:
|
|
870
871
|
return [h, [0, 0, 0], [255, 255, 255]];
|
|
@@ -873,13 +874,13 @@ class J {
|
|
|
873
874
|
const s = new x({
|
|
874
875
|
render: "RGB",
|
|
875
876
|
sourceColor: [
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
877
|
+
a.rgb.r * 255,
|
|
878
|
+
a.rgb.g * 255,
|
|
879
|
+
a.rgb.b * 255
|
|
879
880
|
],
|
|
880
881
|
lightness: h[1],
|
|
881
|
-
hueShifting:
|
|
882
|
-
chromaShifting:
|
|
882
|
+
hueShifting: a.hue.shift !== void 0 ? a.hue.shift : 0,
|
|
883
|
+
chromaShifting: a.chroma.shift !== void 0 ? a.chroma.shift : 100,
|
|
883
884
|
algorithmVersion: this.base.algorithmVersion,
|
|
884
885
|
visionSimulationMode: r.visionSimulationMode
|
|
885
886
|
});
|
|
@@ -900,18 +901,18 @@ class J {
|
|
|
900
901
|
return [h, [0, 0, 0]];
|
|
901
902
|
}
|
|
902
903
|
}
|
|
903
|
-
}),
|
|
904
|
-
id:
|
|
905
|
-
name:
|
|
906
|
-
description:
|
|
904
|
+
}), o = {
|
|
905
|
+
id: a.id,
|
|
906
|
+
name: a.name,
|
|
907
|
+
description: a.description,
|
|
907
908
|
shades: [],
|
|
908
909
|
type: "color"
|
|
909
910
|
}, e = [
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
911
|
+
a.rgb.r * 255,
|
|
912
|
+
a.rgb.g * 255,
|
|
913
|
+
a.rgb.b * 255
|
|
913
914
|
], t = new M();
|
|
914
|
-
t.rgb_r =
|
|
915
|
+
t.rgb_r = a.rgb.r, t.rgb_g = a.rgb.g, t.rgb_b = a.rgb.b, t.rgbToHsluv(), o.shades.push({
|
|
915
916
|
name: "source",
|
|
916
917
|
description: "Source color",
|
|
917
918
|
hex: u(e).hex(),
|
|
@@ -937,11 +938,11 @@ class J {
|
|
|
937
938
|
)
|
|
938
939
|
), l = i.indexOf(Math.min(...i));
|
|
939
940
|
c.forEach((h, s) => {
|
|
940
|
-
const
|
|
941
|
+
const f = u.distance(
|
|
941
942
|
u(e).hex(),
|
|
942
943
|
u(h[1]).hex(),
|
|
943
944
|
"rgb"
|
|
944
|
-
),
|
|
945
|
+
), p = Object.keys(this.currentScale).find(
|
|
945
946
|
(C) => C === h[0][0]
|
|
946
947
|
) ?? "0", $ = new M(), g = new x({
|
|
947
948
|
render: "RGB",
|
|
@@ -952,21 +953,21 @@ class J {
|
|
|
952
953
|
sourceColor: u(e).rgb(),
|
|
953
954
|
visionSimulationMode: r.visionSimulationMode
|
|
954
955
|
}).setColor();
|
|
955
|
-
s === l && this.base.areSourceColorsLocked && !
|
|
956
|
-
name:
|
|
957
|
-
description: `Shade/Tint color with ${typeof h[0][1] == "number" ? h[0][1].toFixed(1) : h[0][1]}% of ${
|
|
958
|
-
hex: s === l && this.base.areSourceColorsLocked && !
|
|
959
|
-
rgb: s === l && this.base.areSourceColorsLocked && !
|
|
960
|
-
gl: s === l && this.base.areSourceColorsLocked && !
|
|
961
|
-
lch: s === l && this.base.areSourceColorsLocked && !
|
|
962
|
-
oklch: s === l && this.base.areSourceColorsLocked && !
|
|
963
|
-
lab: s === l && this.base.areSourceColorsLocked && !
|
|
964
|
-
oklab: s === l && this.base.areSourceColorsLocked && !
|
|
965
|
-
hsl: s === l && this.base.areSourceColorsLocked && !
|
|
956
|
+
s === l && this.base.areSourceColorsLocked && !a.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(), o.shades.push({
|
|
957
|
+
name: p,
|
|
958
|
+
description: `Shade/Tint color with ${typeof h[0][1] == "number" ? h[0][1].toFixed(1) : h[0][1]}% of ${a.alpha.isEnabled ? "opacity" : "lightness"}`,
|
|
959
|
+
hex: s === l && this.base.areSourceColorsLocked && !a.alpha.isEnabled ? u(d).hex() : u(h[1]).hex(),
|
|
960
|
+
rgb: s === l && this.base.areSourceColorsLocked && !a.alpha.isEnabled ? u(d).rgb() : u(h[1]).rgb(),
|
|
961
|
+
gl: s === l && this.base.areSourceColorsLocked && !a.alpha.isEnabled ? u(d).gl() : u(h[1]).gl(),
|
|
962
|
+
lch: s === l && this.base.areSourceColorsLocked && !a.alpha.isEnabled ? u(d).lch() : u(h[1]).lch(),
|
|
963
|
+
oklch: s === l && this.base.areSourceColorsLocked && !a.alpha.isEnabled ? u(d).oklch() : u(h[1]).oklch(),
|
|
964
|
+
lab: s === l && this.base.areSourceColorsLocked && !a.alpha.isEnabled ? u(d).lab() : u(h[1]).lab(),
|
|
965
|
+
oklab: s === l && this.base.areSourceColorsLocked && !a.alpha.isEnabled ? u(d).oklab() : u(h[1]).oklab(),
|
|
966
|
+
hsl: s === l && this.base.areSourceColorsLocked && !a.alpha.isEnabled ? u(d).hsl() : u(h[1]).hsl(),
|
|
966
967
|
hsluv: [$.hsluv_h, $.hsluv_s, $.hsluv_l],
|
|
967
|
-
alpha:
|
|
968
|
-
backgroundColor:
|
|
969
|
-
mixedColor:
|
|
968
|
+
alpha: a.alpha.isEnabled ? parseFloat((h[0][1] / 100).toFixed(2)) : void 0,
|
|
969
|
+
backgroundColor: a.alpha.isEnabled && a.alpha.backgroundColor ? u(h[2]).rgb() : void 0,
|
|
970
|
+
mixedColor: a.alpha.isEnabled && a.alpha.backgroundColor ? new x({
|
|
970
971
|
visionSimulationMode: r.visionSimulationMode
|
|
971
972
|
}).mixColorsRgb(
|
|
972
973
|
[
|
|
@@ -977,26 +978,26 @@ class J {
|
|
|
977
978
|
],
|
|
978
979
|
[...h[2], 1]
|
|
979
980
|
) : void 0,
|
|
980
|
-
isClosestToRef:
|
|
981
|
-
isSourceColorLocked: s === l && this.base.areSourceColorsLocked && !
|
|
982
|
-
isTransparent:
|
|
981
|
+
isClosestToRef: f < 4 && !this.base.areSourceColorsLocked,
|
|
982
|
+
isSourceColorLocked: s === l && this.base.areSourceColorsLocked && !a.alpha.isEnabled,
|
|
983
|
+
isTransparent: a.alpha.isEnabled,
|
|
983
984
|
type: "color shade/tint"
|
|
984
985
|
});
|
|
985
|
-
}), n.colors.push(
|
|
986
|
+
}), n.colors.push(o);
|
|
986
987
|
}), this.paletteData.themes.push(n);
|
|
987
988
|
}), this.paletteData));
|
|
988
989
|
k(this, "makeLibraryData", (r, n) => {
|
|
989
|
-
const
|
|
990
|
-
return
|
|
991
|
-
(
|
|
990
|
+
const a = this.makePaletteData();
|
|
991
|
+
return a.themes.flatMap(
|
|
992
|
+
(o) => o.colors.flatMap(
|
|
992
993
|
(e) => e.shades.flatMap((t) => {
|
|
993
|
-
const i = `${
|
|
994
|
+
const i = `${o.id}:${e.id}:${t.name}`, l = n == null ? void 0 : n.find(
|
|
994
995
|
(h) => h.id === i
|
|
995
996
|
);
|
|
996
997
|
return {
|
|
997
998
|
id: i,
|
|
998
|
-
paletteName:
|
|
999
|
-
themeName:
|
|
999
|
+
paletteName: a.name,
|
|
1000
|
+
themeName: o.name,
|
|
1000
1001
|
colorName: e.name,
|
|
1001
1002
|
shadeName: t.name,
|
|
1002
1003
|
...(r == null ? void 0 : r.includes("alpha")) && { alpha: t.alpha ?? 1 },
|
|
@@ -1036,7 +1037,7 @@ class J {
|
|
|
1036
1037
|
});
|
|
1037
1038
|
k(this, "makeUniversalJson", () => {
|
|
1038
1039
|
const r = this.makePaletteData();
|
|
1039
|
-
return
|
|
1040
|
+
return S(r);
|
|
1040
1041
|
});
|
|
1041
1042
|
k(this, "makeCssCustomProps", (r = "RGB") => {
|
|
1042
1043
|
const n = this.makePaletteData();
|
|
@@ -1087,12 +1088,12 @@ class J {
|
|
|
1087
1088
|
type: "UI_COLOR_PALETTE"
|
|
1088
1089
|
}));
|
|
1089
1090
|
var c;
|
|
1090
|
-
this.base = r, this.themes = n, this.meta =
|
|
1091
|
+
this.base = r, this.themes = n, this.meta = a, this.paletteData = {
|
|
1091
1092
|
name: r.name ?? "UI Color Palette",
|
|
1092
1093
|
description: r.description,
|
|
1093
1094
|
themes: [],
|
|
1094
1095
|
type: "palette"
|
|
1095
|
-
}, this.currentScale = ((c = n.find((
|
|
1096
|
+
}, this.currentScale = ((c = n.find((o) => o.isEnabled)) == null ? void 0 : c.scale) ?? {};
|
|
1096
1097
|
}
|
|
1097
1098
|
}
|
|
1098
1099
|
export {
|