@a_ng_d/utils-ui-color-palette 1.4.0 → 1.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/formats/makeCssCustomProps.d.ts.map +1 -1
- package/dist/formats/makeCsv.d.ts +2 -2
- package/dist/formats/makeCsv.d.ts.map +1 -1
- package/dist/formats/makeDtcgTokens.d.ts.map +1 -1
- package/dist/formats/makeLessVariables.d.ts.map +1 -1
- package/dist/formats/makeScssVariables.d.ts.map +1 -1
- package/dist/formats/makeUniversalTokens.d.ts.map +1 -1
- package/dist/modules/data/data.d.ts +1 -0
- package/dist/modules/data/data.d.ts.map +1 -1
- package/dist/modules/data/data.js +360 -334
- package/dist/modules/data/data.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,54 +1,54 @@
|
|
|
1
1
|
var M = Object.defineProperty;
|
|
2
2
|
var E = (c, r, s) => r in c ? M(c, r, { enumerable: !0, configurable: !0, writable: !0, value: s }) : c[r] = s;
|
|
3
|
-
var
|
|
4
|
-
import { C as
|
|
3
|
+
var u = (c, r, s) => E(c, typeof r != "symbol" ? r + "" : r, s);
|
|
4
|
+
import { C as d, H as C } from "../../color-1CXTuV84.js";
|
|
5
5
|
import { c as p } from "../../index-Beb8qoyd.js";
|
|
6
6
|
const S = (c) => {
|
|
7
|
-
const r = c.themes.filter((
|
|
7
|
+
const r = c.themes.filter((a) => a.type === "custom theme").length === 0 ? c.themes.filter((a) => a.type === "default theme") : c.themes.filter((a) => a.type === "custom theme"), s = {}, 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
|
-
}), h = (
|
|
51
|
+
}), h = (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 S = (c) => {
|
|
|
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
|
-
s[
|
|
97
|
+
return r[0].type === "custom theme" ? r.forEach((a) => {
|
|
98
|
+
s[a.name] = {}, a.colors.forEach((e) => {
|
|
99
99
|
const t = e.shades.find(
|
|
100
100
|
(l) => l.type === "source color"
|
|
101
101
|
);
|
|
102
|
-
s[
|
|
103
|
-
l && t && (s[
|
|
104
|
-
}), s[
|
|
105
|
-
}), s[
|
|
106
|
-
}) : r.forEach((
|
|
107
|
-
|
|
102
|
+
s[a.name][e.name] = {}, e.shades.forEach((l) => {
|
|
103
|
+
l && t && (s[a.name][e.name][l.name] = l.isTransparent ? h(l, t) : o(l));
|
|
104
|
+
}), s[a.name][e.name].description = e.description, s[a.name][e.name].type = "color";
|
|
105
|
+
}), s[a.name].description = a.description, s[a.name].type = "color mode";
|
|
106
|
+
}) : r.forEach((a) => {
|
|
107
|
+
a.colors.forEach((e) => {
|
|
108
108
|
const t = e.shades.find(
|
|
109
109
|
(l) => l.type === "source color"
|
|
110
110
|
);
|
|
111
111
|
s[e.name] = {}, e.shades.forEach((l) => {
|
|
112
|
-
l && t && (s[e.name][l.name] = l.isTransparent ? h(l, t) :
|
|
112
|
+
l && t && (s[e.name][l.name] = l.isTransparent ? h(l, t) : o(l));
|
|
113
113
|
}), s[e.name].description = e.description, s[e.name].type = "color";
|
|
114
114
|
});
|
|
115
115
|
}), s.description = c.description, s.type = "color palette", JSON.stringify(s, null, " ");
|
|
@@ -121,18 +121,18 @@ class f {
|
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
123
|
const T = (c) => {
|
|
124
|
-
const r = c.themes.filter((
|
|
125
|
-
return r.forEach((
|
|
124
|
+
const r = c.themes.filter((o) => o.type === "custom theme").length === 0 ? c.themes.filter((o) => o.type === "default theme") : c.themes.filter((o) => o.type === "custom theme"), s = [];
|
|
125
|
+
return r.forEach((o) => {
|
|
126
126
|
const h = [];
|
|
127
|
-
|
|
128
|
-
const e =
|
|
129
|
-
h.push(`// ${
|
|
127
|
+
o.colors.forEach((a) => {
|
|
128
|
+
const e = a.shades.find((t) => t.type === "source color");
|
|
129
|
+
h.push(`// ${a.name}`), a.shades.reverse().forEach((t) => {
|
|
130
130
|
h.push(
|
|
131
|
-
t.isTransparent ? `static let ${new f(
|
|
131
|
+
t.isTransparent ? `static let ${new f(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: ${t.alpha ?? 1})` : `static let ${new f(
|
|
135
|
+
)}, alpha: ${t.alpha ?? 1})` : `static let ${new f(a.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,7 +140,7 @@ const T = (c) => {
|
|
|
140
140
|
);
|
|
141
141
|
}), h.push("");
|
|
142
142
|
}), h.pop(), r[0].type === "custom theme" ? s.push(
|
|
143
|
-
`struct ${new f(
|
|
143
|
+
`struct ${new f(o.name).doPascalCase()} {
|
|
144
144
|
${h.join(
|
|
145
145
|
`
|
|
146
146
|
`
|
|
@@ -156,46 +156,46 @@ struct Color {
|
|
|
156
156
|
`)}
|
|
157
157
|
}`;
|
|
158
158
|
}, L = (c) => {
|
|
159
|
-
const r = c.themes.filter((
|
|
159
|
+
const r = c.themes.filter((o) => o.type === "custom theme").length === 0 ? c.themes.filter((o) => o.type === "default theme") : c.themes.filter((o) => o.type === "custom theme"), s = {
|
|
160
160
|
theme: {
|
|
161
161
|
colors: {}
|
|
162
162
|
}
|
|
163
163
|
};
|
|
164
|
-
return c.themes[0].colors.forEach((
|
|
165
|
-
s.theme.colors[new f(
|
|
166
|
-
}), r[0].type === "custom theme" ? r.forEach((
|
|
167
|
-
|
|
168
|
-
const
|
|
164
|
+
return c.themes[0].colors.forEach((o) => {
|
|
165
|
+
s.theme.colors[new f(o.name).doKebabCase()] = {};
|
|
166
|
+
}), r[0].type === "custom theme" ? r.forEach((o) => {
|
|
167
|
+
o.colors.forEach((h) => {
|
|
168
|
+
const a = h.shades.find(
|
|
169
169
|
(e) => e.type === "source color"
|
|
170
170
|
);
|
|
171
|
-
s.theme.colors[new f(h.name).doKebabCase()][new f(
|
|
172
|
-
s.theme.colors[new f(h.name).doKebabCase()][new f(
|
|
171
|
+
s.theme.colors[new f(h.name).doKebabCase()][new f(o.name).doKebabCase()] = {}, h.shades.forEach((e) => {
|
|
172
|
+
s.theme.colors[new f(h.name).doKebabCase()][new f(o.name).doKebabCase()][new f(e.name).doKebabCase()] = e.isTransparent ? p((a == null ? void 0 : a.hex) ?? "#000000").alpha(e.alpha ?? 1).hex() : e.hex;
|
|
173
173
|
});
|
|
174
174
|
});
|
|
175
|
-
}) : r.forEach((
|
|
176
|
-
|
|
177
|
-
const
|
|
175
|
+
}) : r.forEach((o) => {
|
|
176
|
+
o.colors.forEach((h) => {
|
|
177
|
+
const a = h.shades.find(
|
|
178
178
|
(e) => e.type === "source color"
|
|
179
179
|
);
|
|
180
180
|
s.theme.colors[new f(h.name).doKebabCase()] = {}, h.shades.sort().forEach((e) => {
|
|
181
|
-
s.theme.colors[new f(h.name).doKebabCase()][new f(e.name).doKebabCase()] = e.isTransparent ? p((
|
|
181
|
+
s.theme.colors[new f(h.name).doKebabCase()][new f(e.name).doKebabCase()] = e.isTransparent ? p((a == null ? void 0 : a.hex) ?? "#000000").alpha(e.alpha ?? 1).hex() : e.hex;
|
|
182
182
|
});
|
|
183
183
|
});
|
|
184
184
|
}), s;
|
|
185
|
-
},
|
|
186
|
-
const r = c.themes.filter((
|
|
187
|
-
return r.forEach((
|
|
188
|
-
|
|
189
|
-
const
|
|
185
|
+
}, N = (c) => {
|
|
186
|
+
const r = c.themes.filter((o) => o.type === "custom theme").length === 0 ? c.themes.filter((o) => o.type === "default theme") : c.themes.filter((o) => o.type === "custom theme"), s = [];
|
|
187
|
+
return r.forEach((o) => {
|
|
188
|
+
o.colors.forEach((h) => {
|
|
189
|
+
const a = h.shades.find((t) => t.type === "source color"), e = [];
|
|
190
190
|
e.push(
|
|
191
|
-
`// ${r[0].type === "custom theme" ?
|
|
191
|
+
`// ${r[0].type === "custom theme" ? o.name + " - " : ""}${h.name}`
|
|
192
192
|
), h.shades.reverse().forEach((t) => {
|
|
193
193
|
e.push(
|
|
194
|
-
t.isTransparent ? `public let ${r[0].type === "custom theme" ? new f(
|
|
194
|
+
t.isTransparent ? `public let ${r[0].type === "custom theme" ? new f(o.name + " " + h.name).doPascalCase() : new f(h.name).doPascalCase()}${t.name === "source" ? "Source" : t.name} = Color(red: ${a == null ? void 0 : a.gl[0].toFixed(
|
|
195
195
|
3
|
|
196
|
-
)}, green: ${
|
|
196
|
+
)}, green: ${a == null ? void 0 : a.gl[1].toFixed(3)}, blue: ${t.gl[2].toFixed(
|
|
197
197
|
3
|
|
198
|
-
)}).opacity(${t.alpha ?? 1})` : `public let ${r[0].type === "custom theme" ? new f(
|
|
198
|
+
)}).opacity(${t.alpha ?? 1})` : `public let ${r[0].type === "custom theme" ? new f(o.name + " " + h.name).doPascalCase() : new f(h.name).doPascalCase()}${t.name === "source" ? "Source" : t.name} = Color(red: ${t.gl[0].toFixed(
|
|
199
199
|
3
|
|
200
200
|
)}, green: ${t.gl[1].toFixed(3)}, blue: ${t.gl[2].toFixed(
|
|
201
201
|
3
|
|
@@ -214,42 +214,43 @@ public extension Color {
|
|
|
214
214
|
)}
|
|
215
215
|
}
|
|
216
216
|
}`;
|
|
217
|
-
},
|
|
217
|
+
}, H = (c) => {
|
|
218
218
|
const r = c.themes.filter((h) => h.type === "custom theme").length === 0 ? c.themes.filter((h) => h.type === "default theme") : c.themes.filter((h) => h.type === "custom theme"), s = {
|
|
219
219
|
color: {}
|
|
220
|
-
},
|
|
220
|
+
}, o = (h, a, e) => ({
|
|
221
221
|
type: "color",
|
|
222
|
-
value:
|
|
223
|
-
comment: h.description !== "" ? h.description + " - " +
|
|
222
|
+
value: a.isTransparent ? p(e.hex).alpha(a.alpha ?? 1).hex() : a.hex,
|
|
223
|
+
comment: h.description !== "" ? h.description + " - " + a.description : a.description
|
|
224
224
|
});
|
|
225
225
|
return c.themes[0].colors.forEach((h) => {
|
|
226
226
|
s.color[h.name] = {};
|
|
227
227
|
}), r[0].type === "custom theme" ? r.forEach((h) => {
|
|
228
|
-
h.colors.forEach((
|
|
229
|
-
const e =
|
|
228
|
+
h.colors.forEach((a) => {
|
|
229
|
+
const e = a.shades.find(
|
|
230
230
|
(t) => t.type === "source color"
|
|
231
231
|
);
|
|
232
|
-
s.color[
|
|
233
|
-
t && e && (s.color[
|
|
234
|
-
|
|
232
|
+
s.color[a.name][h.name] = {}, a.shades.forEach((t) => {
|
|
233
|
+
t && e && (s.color[a.name][h.name][t.name] = o(
|
|
234
|
+
a,
|
|
235
235
|
t,
|
|
236
236
|
e
|
|
237
237
|
));
|
|
238
238
|
});
|
|
239
239
|
});
|
|
240
240
|
}) : r.forEach((h) => {
|
|
241
|
-
h.colors.forEach((
|
|
242
|
-
const e =
|
|
241
|
+
h.colors.forEach((a) => {
|
|
242
|
+
const e = a.shades.find(
|
|
243
243
|
(t) => t.type === "source color"
|
|
244
244
|
);
|
|
245
|
-
s.color[
|
|
246
|
-
t && e && (s.color[
|
|
245
|
+
s.color[a.name] = {}, a.shades.forEach((t) => {
|
|
246
|
+
t && e && (s.color[a.name][t.name] = o(a, t, e));
|
|
247
247
|
});
|
|
248
248
|
});
|
|
249
249
|
}), JSON.stringify(s, null, " ");
|
|
250
|
-
},
|
|
251
|
-
const s = c.themes.filter((e) => e.type === "custom theme").length === 0 ? c.themes.filter((e) => e.type === "default theme") : c.themes.filter((e) => e.type === "custom theme"),
|
|
250
|
+
}, P = (c, r) => {
|
|
251
|
+
const s = c.themes.filter((e) => e.type === "custom theme").length === 0 ? c.themes.filter((e) => e.type === "default theme") : c.themes.filter((e) => e.type === "custom theme"), o = [], h = (e) => {
|
|
252
252
|
var l;
|
|
253
|
+
isNaN(e.hsl[0]) && (e.hsl[0] = 0), isNaN(e.lch[2]) && (e.lch[2] = 0);
|
|
253
254
|
const t = {
|
|
254
255
|
RGB: () => `rgb(${Math.floor(e.rgb[0])}, ${Math.floor(
|
|
255
256
|
e.rgb[1]
|
|
@@ -266,58 +267,58 @@ public extension Color {
|
|
|
266
267
|
)}, ${e.gl[2].toFixed(3)})`
|
|
267
268
|
};
|
|
268
269
|
return (l = t[r ?? "RGB"]) == null ? void 0 : l.call(t);
|
|
269
|
-
},
|
|
270
|
-
var
|
|
270
|
+
}, a = (e, t) => {
|
|
271
|
+
var i;
|
|
271
272
|
const l = {
|
|
272
273
|
RGB: () => {
|
|
273
|
-
var
|
|
274
|
+
var n;
|
|
274
275
|
return `rgba(${Math.floor(t.rgb[0])}, ${Math.floor(
|
|
275
276
|
t.rgb[1]
|
|
276
|
-
)}, ${Math.floor(t.rgb[2])}, ${((
|
|
277
|
+
)}, ${Math.floor(t.rgb[2])}, ${((n = e.alpha) == null ? void 0 : n.toFixed(2)) ?? 1})`;
|
|
277
278
|
},
|
|
278
279
|
HEX: () => p(t.hex).alpha(e.alpha ?? 1).hex(),
|
|
279
280
|
HSL: () => {
|
|
280
|
-
var
|
|
281
|
+
var n;
|
|
281
282
|
return `hsla(${Math.floor(t.hsl[0])}, ${Math.floor(
|
|
282
283
|
t.hsl[1] * 100
|
|
283
|
-
)}%, ${Math.floor(t.hsl[2] * 100)}%, ${((
|
|
284
|
+
)}%, ${Math.floor(t.hsl[2] * 100)}%, ${((n = e.alpha) == null ? void 0 : n.toFixed(2)) ?? 1})`;
|
|
284
285
|
},
|
|
285
286
|
LCH: () => {
|
|
286
|
-
var
|
|
287
|
+
var n;
|
|
287
288
|
return `lch(${Math.floor(t.lch[0])}% ${Math.floor(
|
|
288
289
|
t.lch[1]
|
|
289
|
-
)} ${Math.floor(t.lch[2])} / ${((
|
|
290
|
+
)} ${Math.floor(t.lch[2])} / ${((n = e.alpha) == null ? void 0 : n.toFixed(2)) ?? 1})`;
|
|
290
291
|
},
|
|
291
292
|
P3: () => {
|
|
292
|
-
var
|
|
293
|
+
var n;
|
|
293
294
|
return `color(display-p3 ${t.gl[0].toFixed(3)}, ${t.gl[1].toFixed(
|
|
294
295
|
3
|
|
295
|
-
)}, ${t.gl[2].toFixed(3)}, ${((
|
|
296
|
+
)}, ${t.gl[2].toFixed(3)}, ${((n = e.alpha) == null ? void 0 : n.toFixed(2)) ?? 1})`;
|
|
296
297
|
}
|
|
297
298
|
};
|
|
298
|
-
return (
|
|
299
|
+
return (i = l[r ?? "RGB"]) == null ? void 0 : i.call(l);
|
|
299
300
|
};
|
|
300
301
|
return s.forEach((e) => {
|
|
301
302
|
const t = [];
|
|
302
303
|
e.type === "custom theme" && (t.push(`// ${e.name} mode`), t.push(`@mixin ${new f(e.name).doCamelCase()}-mode {`)), e.colors.forEach((l) => {
|
|
303
|
-
t.push(`// ${l.name}`), l.shades.reverse().forEach((
|
|
304
|
-
const
|
|
305
|
-
|
|
306
|
-
` ${m}: ${
|
|
304
|
+
t.push(`// ${l.name}`), l.shades.reverse().forEach((i) => {
|
|
305
|
+
const n = l.shades.find((b) => b.type === "source color"), m = `$${new f(l.name).doKebabCase()}-${i.name}`;
|
|
306
|
+
n && (e.type === "custom theme" ? t.push(
|
|
307
|
+
` ${m}: ${i.isTransparent ? a(i, n) : h(i)};`
|
|
307
308
|
) : t.push(
|
|
308
|
-
`${m}: ${
|
|
309
|
+
`${m}: ${i.isTransparent ? a(i, n) : h(i)};`
|
|
309
310
|
));
|
|
310
311
|
}), t.push("");
|
|
311
|
-
}), e.type === "custom theme" && t.push("}"),
|
|
312
|
+
}), e.type === "custom theme" && t.push("}"), o.push(t.join(`
|
|
312
313
|
`));
|
|
313
|
-
}),
|
|
314
|
+
}), o.push(`
|
|
314
315
|
// Color modes map
|
|
315
316
|
$modes: (`), s.filter((e) => e.type === "custom theme").forEach((e, t, l) => {
|
|
316
|
-
const
|
|
317
|
-
|
|
318
|
-
` '${
|
|
317
|
+
const i = new f(e.name).doKebabCase();
|
|
318
|
+
o.push(
|
|
319
|
+
` '${i}': ${new f(e.name).doCamelCase()}-mode${t < l.length - 1 ? "," : ""}`
|
|
319
320
|
);
|
|
320
|
-
}),
|
|
321
|
+
}), o.push(`);
|
|
321
322
|
|
|
322
323
|
// Mode application mixin
|
|
323
324
|
@mixin with-color-mode() {
|
|
@@ -329,19 +330,19 @@ $modes: (`), s.filter((e) => e.type === "custom theme").forEach((e, t, l) => {
|
|
|
329
330
|
@content($mode);
|
|
330
331
|
}
|
|
331
332
|
}
|
|
332
|
-
}`),
|
|
333
|
+
}`), o.join(`
|
|
333
334
|
|
|
334
335
|
`);
|
|
335
|
-
},
|
|
336
|
-
const r = c.themes.filter((
|
|
337
|
-
return r.forEach((
|
|
338
|
-
|
|
339
|
-
const
|
|
336
|
+
}, A = (c) => {
|
|
337
|
+
const r = c.themes.filter((o) => o.type === "custom theme").length === 0 ? c.themes.filter((o) => o.type === "default theme") : c.themes.filter((o) => o.type === "custom theme"), s = [];
|
|
338
|
+
return r.forEach((o) => {
|
|
339
|
+
o.colors.forEach((h) => {
|
|
340
|
+
const a = h.shades.find((t) => t.type === "source color"), e = [];
|
|
340
341
|
e.push(
|
|
341
|
-
`<!--${r[0].type === "custom theme" ? `${
|
|
342
|
+
`<!--${r[0].type === "custom theme" ? `${o.name} - ${h.name}-->` : `${h.name}-->`}`
|
|
342
343
|
), h.shades.reverse().forEach((t) => {
|
|
343
344
|
e.push(
|
|
344
|
-
`<color name="${r[0].type === "custom theme" ? new f(
|
|
345
|
+
`<color name="${r[0].type === "custom theme" ? new f(o.name + " " + h.name).doSnakeCase() : new f(h.name).doSnakeCase()}_${t.name}">${t.isTransparent ? p((a == null ? void 0 : a.hex) ?? "#000000").alpha(t.alpha ?? 1).hex() : t.hex}</color>`
|
|
345
346
|
);
|
|
346
347
|
}), e.push(""), e.forEach((t) => s.push(t));
|
|
347
348
|
});
|
|
@@ -352,39 +353,39 @@ $modes: (`), s.filter((e) => e.type === "custom theme").forEach((e, t, l) => {
|
|
|
352
353
|
`
|
|
353
354
|
)}
|
|
354
355
|
</resources>`;
|
|
355
|
-
},
|
|
356
|
-
const r = c.themes.filter((
|
|
356
|
+
}, R = (c) => {
|
|
357
|
+
const r = c.themes.filter((a) => a.type === "custom theme").length === 0 ? c.themes.filter((a) => a.type === "default theme") : c.themes.filter((a) => a.type === "custom theme"), s = {
|
|
357
358
|
$themes: [],
|
|
358
359
|
$metadata: {
|
|
359
360
|
activeThemes: [],
|
|
360
361
|
tokenSetOrder: [],
|
|
361
362
|
activeSets: []
|
|
362
363
|
}
|
|
363
|
-
},
|
|
364
|
+
}, o = c.name, h = (a, e, t) => ({
|
|
364
365
|
$type: "color",
|
|
365
366
|
$value: e.isTransparent ? p(t.hex).alpha(e.alpha ?? 1).hex() : e.hex,
|
|
366
|
-
$description:
|
|
367
|
+
$description: a.description !== "" ? a.description + " - " + e.description : e.description
|
|
367
368
|
});
|
|
368
|
-
return r[0].type === "custom theme" ? r.forEach((
|
|
369
|
-
|
|
369
|
+
return r[0].type === "custom theme" ? r.forEach((a) => {
|
|
370
|
+
a.colors.forEach((e) => {
|
|
370
371
|
const t = e.shades.find(
|
|
371
372
|
(l) => l.type === "source color"
|
|
372
373
|
);
|
|
373
|
-
s[`${
|
|
374
|
-
l && t && (s[`${
|
|
374
|
+
s[`${a.name}/${e.name}`] = {}, e.shades.forEach((l) => {
|
|
375
|
+
l && t && (s[`${a.name}/${e.name}`][l.name] = h(
|
|
375
376
|
e,
|
|
376
377
|
l,
|
|
377
378
|
t
|
|
378
379
|
));
|
|
379
380
|
});
|
|
380
381
|
});
|
|
381
|
-
}) : r.forEach((
|
|
382
|
-
|
|
382
|
+
}) : r.forEach((a) => {
|
|
383
|
+
a.colors.forEach((e) => {
|
|
383
384
|
const t = e.shades.find(
|
|
384
385
|
(l) => l.type === "source color"
|
|
385
386
|
);
|
|
386
|
-
s[`${
|
|
387
|
-
l && t && (s[`${
|
|
387
|
+
s[`${o}/${e.name}`] = {}, e.shades.forEach((l) => {
|
|
388
|
+
l && t && (s[`${o}/${e.name}`][l.name] = h(
|
|
388
389
|
e,
|
|
389
390
|
l,
|
|
390
391
|
t
|
|
@@ -392,9 +393,10 @@ $modes: (`), s.filter((e) => e.type === "custom theme").forEach((e, t, l) => {
|
|
|
392
393
|
});
|
|
393
394
|
});
|
|
394
395
|
}), JSON.stringify(s, null, " ");
|
|
395
|
-
},
|
|
396
|
-
const s = c.themes.filter((t) => t.type === "custom theme").length === 0 ? c.themes.filter((t) => t.type === "default theme") : c.themes.filter((t) => t.type === "custom theme"),
|
|
397
|
-
var
|
|
396
|
+
}, B = (c, r) => {
|
|
397
|
+
const s = c.themes.filter((t) => t.type === "custom theme").length === 0 ? c.themes.filter((t) => t.type === "default theme") : c.themes.filter((t) => t.type === "custom theme"), o = [], h = (t) => {
|
|
398
|
+
var i;
|
|
399
|
+
isNaN(t.hsl[0]) && (t.hsl[0] = 0), isNaN(t.lch[2]) && (t.lch[2] = 0);
|
|
398
400
|
const l = {
|
|
399
401
|
RGB: () => `rgb(${Math.floor(t.rgb[0])}, ${Math.floor(
|
|
400
402
|
t.rgb[1]
|
|
@@ -410,10 +412,10 @@ $modes: (`), s.filter((e) => e.type === "custom theme").forEach((e, t, l) => {
|
|
|
410
412
|
3
|
|
411
413
|
)}, ${t.gl[2].toFixed(3)})`
|
|
412
414
|
};
|
|
413
|
-
return (
|
|
414
|
-
},
|
|
415
|
-
var
|
|
416
|
-
const
|
|
415
|
+
return (i = l[r ?? "RGB"]) == null ? void 0 : i.call(l);
|
|
416
|
+
}, a = (t, l) => {
|
|
417
|
+
var n;
|
|
418
|
+
const i = {
|
|
417
419
|
RGB: () => {
|
|
418
420
|
var m;
|
|
419
421
|
return `rgba(${Math.floor(l.rgb[0])}, ${Math.floor(
|
|
@@ -440,51 +442,51 @@ $modes: (`), s.filter((e) => e.type === "custom theme").forEach((e, t, l) => {
|
|
|
440
442
|
)}, ${l.gl[2].toFixed(3)}, ${((m = t.alpha) == null ? void 0 : m.toFixed(2)) ?? 1})`;
|
|
441
443
|
}
|
|
442
444
|
};
|
|
443
|
-
return (
|
|
445
|
+
return (n = i[r ?? "RGB"]) == null ? void 0 : n.call(i);
|
|
444
446
|
}, e = s.find(
|
|
445
447
|
(t) => t.type === "default theme"
|
|
446
448
|
);
|
|
447
449
|
if (e) {
|
|
448
450
|
const t = [];
|
|
449
451
|
e.colors.forEach((l) => {
|
|
450
|
-
t.push(`// ${l.name}`), l.shades.reverse().forEach((
|
|
451
|
-
const
|
|
452
|
-
|
|
453
|
-
`${m}: ${
|
|
452
|
+
t.push(`// ${l.name}`), l.shades.reverse().forEach((i) => {
|
|
453
|
+
const n = l.shades.find((b) => b.type === "source color"), m = `@${new f(l.name).doKebabCase()}-${i.name}`;
|
|
454
|
+
n && t.push(
|
|
455
|
+
`${m}: ${i.isTransparent ? a(i, n) : h(i)};`
|
|
454
456
|
);
|
|
455
457
|
}), t.push("");
|
|
456
|
-
}),
|
|
458
|
+
}), o.push(t.join(`
|
|
457
459
|
`));
|
|
458
460
|
}
|
|
459
461
|
return s.filter((t) => t.type === "custom theme").forEach((t) => {
|
|
460
462
|
const l = new f(t.name).doKebabCase();
|
|
461
|
-
|
|
463
|
+
o.push(`
|
|
462
464
|
// ${t.name} mode
|
|
463
465
|
#${l} {
|
|
464
466
|
.mode() {`);
|
|
465
|
-
const
|
|
466
|
-
t.colors.forEach((
|
|
467
|
-
|
|
468
|
-
const
|
|
469
|
-
|
|
470
|
-
` ${x}: ${m.isTransparent ?
|
|
467
|
+
const i = [];
|
|
468
|
+
t.colors.forEach((n) => {
|
|
469
|
+
i.push(` // ${n.name}`), n.shades.reverse().forEach((m) => {
|
|
470
|
+
const b = n.shades.find(($) => $.type === "source color"), x = `@${new f(n.name).doKebabCase()}-${m.name}`;
|
|
471
|
+
b && i.push(
|
|
472
|
+
` ${x}: ${m.isTransparent ? a(m, b) : h(m)};`
|
|
471
473
|
);
|
|
472
|
-
}),
|
|
473
|
-
}),
|
|
474
|
-
`)),
|
|
474
|
+
}), i.push("");
|
|
475
|
+
}), i.length > 0 && i.pop(), o.push(i.join(`
|
|
476
|
+
`)), o.push(` }
|
|
475
477
|
}`);
|
|
476
|
-
}),
|
|
478
|
+
}), o.push(`
|
|
477
479
|
// Mode application
|
|
478
480
|
.apply-mode(@mode) {
|
|
479
481
|
& when (@mode = default) {
|
|
480
482
|
// Default mode variables are already available
|
|
481
483
|
}`), s.filter((t) => t.type === "custom theme").forEach((t) => {
|
|
482
484
|
const l = new f(t.name).doKebabCase();
|
|
483
|
-
|
|
485
|
+
o.push(`
|
|
484
486
|
& when (@mode = ${l}) {
|
|
485
487
|
#${l} > .mode();
|
|
486
488
|
}`);
|
|
487
|
-
}),
|
|
489
|
+
}), o.push(`}
|
|
488
490
|
|
|
489
491
|
// Mode application via HTML attribute
|
|
490
492
|
.with-mode(@selector) {
|
|
@@ -501,12 +503,13 @@ $modes: (`), s.filter((e) => e.type === "custom theme").forEach((e, t, l) => {
|
|
|
501
503
|
}).join(`
|
|
502
504
|
|
|
503
505
|
`)}
|
|
504
|
-
}`),
|
|
506
|
+
}`), o.join(`
|
|
505
507
|
|
|
506
508
|
`);
|
|
507
|
-
},
|
|
508
|
-
const s = c.themes.filter((e) => e.type === "custom theme").length === 0 ? c.themes.filter((e) => e.type === "default theme") : c.themes.filter((e) => e.type === "custom theme"),
|
|
509
|
+
}, K = (c, r) => {
|
|
510
|
+
const s = c.themes.filter((e) => e.type === "custom theme").length === 0 ? c.themes.filter((e) => e.type === "default theme") : c.themes.filter((e) => e.type === "custom theme"), o = {}, h = (e) => {
|
|
509
511
|
var l;
|
|
512
|
+
isNaN(e.oklch[2]) && (e.oklch[2] = 0);
|
|
510
513
|
const t = {
|
|
511
514
|
RGB: () => ({
|
|
512
515
|
colorSpace: "srgb",
|
|
@@ -528,8 +531,8 @@ $modes: (`), s.filter((e) => e.type === "custom theme").forEach((e, t, l) => {
|
|
|
528
531
|
})
|
|
529
532
|
};
|
|
530
533
|
return (l = t[r ?? "RGB"]) == null ? void 0 : l.call(t);
|
|
531
|
-
},
|
|
532
|
-
var
|
|
534
|
+
}, a = (e, t) => {
|
|
535
|
+
var i;
|
|
533
536
|
const l = {
|
|
534
537
|
RGB: () => ({
|
|
535
538
|
colorSpace: "srgb",
|
|
@@ -552,43 +555,62 @@ $modes: (`), s.filter((e) => e.type === "custom theme").forEach((e, t, l) => {
|
|
|
552
555
|
alpha: t.alpha
|
|
553
556
|
})
|
|
554
557
|
};
|
|
555
|
-
return (
|
|
558
|
+
return (i = l[r ?? "RGB"]) == null ? void 0 : i.call(l);
|
|
556
559
|
};
|
|
557
560
|
return s[0].type === "custom theme" ? s.forEach((e) => {
|
|
558
561
|
e.colors.forEach((t) => {
|
|
559
562
|
const l = t.shades.find(
|
|
560
|
-
(
|
|
563
|
+
(i) => i.type === "source color"
|
|
561
564
|
);
|
|
562
|
-
|
|
565
|
+
o[t.name] || (o[t.name] = {
|
|
563
566
|
$type: "color"
|
|
564
|
-
}), t.shades.forEach((
|
|
565
|
-
!
|
|
567
|
+
}), t.shades.forEach((i) => {
|
|
568
|
+
!o[t.name][i.name] && l && (o[t.name][i.name] = {
|
|
566
569
|
$type: "color",
|
|
567
|
-
$value:
|
|
568
|
-
$description: t.description !== "" ? t.description + " - " +
|
|
570
|
+
$value: i.isTransparent ? a(l, i) : h(i),
|
|
571
|
+
$description: t.description !== "" ? t.description + " - " + i.description : i.description,
|
|
569
572
|
$extensions: {
|
|
570
573
|
mode: {}
|
|
571
574
|
}
|
|
572
|
-
}), l && (
|
|
575
|
+
}), l && (o[t.name][i.name].$extensions.mode[e.name] = i.isTransparent ? a(l, i) : h(i));
|
|
573
576
|
});
|
|
574
577
|
});
|
|
575
578
|
}) : s.forEach((e) => {
|
|
576
579
|
e.colors.forEach((t) => {
|
|
577
580
|
const l = t.shades.find(
|
|
578
|
-
(
|
|
581
|
+
(i) => i.type === "source color"
|
|
579
582
|
);
|
|
580
|
-
|
|
581
|
-
|
|
583
|
+
o[t.name] = {}, t.shades.forEach((i) => {
|
|
584
|
+
i && l && (o[t.name][i.name] = {
|
|
582
585
|
$type: "color",
|
|
583
|
-
$value:
|
|
584
|
-
$description: t.description !== "" ? t.description + " - " +
|
|
586
|
+
$value: i.isTransparent ? a(l, i) : h(i),
|
|
587
|
+
$description: t.description !== "" ? t.description + " - " + i.description : i.description
|
|
585
588
|
});
|
|
586
589
|
});
|
|
587
590
|
});
|
|
588
|
-
}), JSON.stringify(
|
|
589
|
-
}, j = (c
|
|
590
|
-
const
|
|
591
|
+
}), JSON.stringify(o, null, " ");
|
|
592
|
+
}, j = (c) => {
|
|
593
|
+
const r = c.themes.filter((l) => l.type === "custom theme").length === 0 ? c.themes.filter((l) => l.type === "default theme") : c.themes.filter((l) => l.type === "custom theme"), s = [], o = [], h = [], a = [], e = [], t = [];
|
|
594
|
+
return r.forEach((l) => {
|
|
595
|
+
l.colors.forEach((i) => {
|
|
596
|
+
i.shades.forEach((n) => {
|
|
597
|
+
h.push(n.name), a.push(Math.floor(n.lch[0])), e.push(Math.floor(n.lch[1])), t.push(Math.floor(n.lch[2]));
|
|
598
|
+
}), s.push({
|
|
599
|
+
name: i.name,
|
|
600
|
+
csv: `${i.name},Lightness,Chroma,Hue
|
|
601
|
+
${h.map((n, m) => `${n},${a[m]},${e[m]},${t[m]}`).join(`
|
|
602
|
+
`)}`
|
|
603
|
+
}), h.splice(0, h.length), a.splice(0, a.length), e.splice(0, e.length), t.splice(0, t.length);
|
|
604
|
+
}), o.push({
|
|
605
|
+
name: l.name,
|
|
606
|
+
colors: s.map((i) => i),
|
|
607
|
+
type: l.type
|
|
608
|
+
}), s.splice(0, s.length);
|
|
609
|
+
}), o;
|
|
610
|
+
}, G = (c, r) => {
|
|
611
|
+
const s = c.themes.filter((e) => e.type === "custom theme").length === 0 ? c.themes.filter((e) => e.type === "default theme") : c.themes.filter((e) => e.type === "custom theme"), o = [], h = (e) => {
|
|
591
612
|
var l;
|
|
613
|
+
isNaN(e.hsl[0]) && (e.hsl[0] = 0), isNaN(e.lch[2]) && (e.lch[2] = 0);
|
|
592
614
|
const t = {
|
|
593
615
|
RGB: () => `rgb(${Math.floor(e.rgb[0])}, ${Math.floor(
|
|
594
616
|
e.rgb[1]
|
|
@@ -597,73 +619,73 @@ $modes: (`), s.filter((e) => e.type === "custom theme").forEach((e, t, l) => {
|
|
|
597
619
|
HSL: () => `hsl(${Math.floor(e.hsl[0])} ${Math.floor(
|
|
598
620
|
e.hsl[1] * 100
|
|
599
621
|
)}% ${Math.floor(e.hsl[2] * 100)}%)`,
|
|
600
|
-
LCH: () => `lch(${Math.floor(e.lch[0])}% ${Math.floor(
|
|
622
|
+
LCH: () => (e.lch[2] === null && (e.lch[2] = 0), `lch(${Math.floor(e.lch[0])}% ${Math.floor(
|
|
601
623
|
e.lch[1]
|
|
602
|
-
)} ${Math.floor(e.lch[2])})
|
|
624
|
+
)} ${Math.floor(e.lch[2])})`),
|
|
603
625
|
P3: () => `color(display-p3 ${e.gl[0].toFixed(3)} ${e.gl[1].toFixed(
|
|
604
626
|
3
|
|
605
627
|
)} ${e.gl[2].toFixed(3)})`
|
|
606
628
|
};
|
|
607
629
|
return (l = t[r ?? "RGB"]) == null ? void 0 : l.call(t);
|
|
608
|
-
},
|
|
609
|
-
var
|
|
630
|
+
}, a = (e, t) => {
|
|
631
|
+
var i;
|
|
610
632
|
const l = {
|
|
611
633
|
RGB: () => {
|
|
612
|
-
var
|
|
634
|
+
var n;
|
|
613
635
|
return `rgb(${Math.floor(t.rgb[0])}, ${Math.floor(
|
|
614
636
|
t.rgb[1]
|
|
615
|
-
)}, ${Math.floor(t.rgb[2])} / ${((
|
|
637
|
+
)}, ${Math.floor(t.rgb[2])} / ${((n = e.alpha) == null ? void 0 : n.toFixed(2)) ?? 1})`;
|
|
616
638
|
},
|
|
617
639
|
HEX: () => p(t.hex).alpha(e.alpha ?? 1).hex(),
|
|
618
640
|
HSL: () => {
|
|
619
|
-
var
|
|
641
|
+
var n;
|
|
620
642
|
return `hsl(${Math.floor(t.hsl[0])} ${Math.floor(
|
|
621
643
|
t.hsl[1] * 100
|
|
622
|
-
)}% ${Math.floor(t.hsl[2] * 100)}% / ${((
|
|
644
|
+
)}% ${Math.floor(t.hsl[2] * 100)}% / ${((n = e.alpha) == null ? void 0 : n.toFixed(2)) ?? 1})`;
|
|
623
645
|
},
|
|
624
646
|
LCH: () => {
|
|
625
|
-
var
|
|
647
|
+
var n;
|
|
626
648
|
return `lch(${Math.floor(t.lch[0])}% ${Math.floor(
|
|
627
649
|
t.lch[1]
|
|
628
|
-
)} ${Math.floor(t.lch[2])} / ${((
|
|
650
|
+
)} ${Math.floor(t.lch[2])} / ${((n = e.alpha) == null ? void 0 : n.toFixed(2)) ?? 1})`;
|
|
629
651
|
},
|
|
630
652
|
P3: () => {
|
|
631
|
-
var
|
|
653
|
+
var n;
|
|
632
654
|
return `color(display-p3 ${t.gl[0].toFixed(3)} ${t.gl[1].toFixed(
|
|
633
655
|
3
|
|
634
|
-
)} ${t.gl[2].toFixed(3)} / ${((
|
|
656
|
+
)} ${t.gl[2].toFixed(3)} / ${((n = e.alpha) == null ? void 0 : n.toFixed(2)) ?? 1})`;
|
|
635
657
|
}
|
|
636
658
|
};
|
|
637
|
-
return (
|
|
659
|
+
return (i = l[r ?? "RGB"]) == null ? void 0 : i.call(l);
|
|
638
660
|
};
|
|
639
661
|
return s.forEach((e) => {
|
|
640
662
|
const t = [];
|
|
641
663
|
e.colors.forEach((l) => {
|
|
642
|
-
t.push(`/* ${l.name} */`), l.shades.reverse().forEach((
|
|
643
|
-
const
|
|
644
|
-
|
|
645
|
-
`--${new f(l.name).doKebabCase()}-${
|
|
664
|
+
t.push(`/* ${l.name} */`), l.shades.reverse().forEach((i) => {
|
|
665
|
+
const n = l.shades.find((m) => m.type === "source color");
|
|
666
|
+
n && t.push(
|
|
667
|
+
`--${new f(l.name).doKebabCase()}-${i.name}: ${i.isTransparent ? a(i, n) : h(i)};`
|
|
646
668
|
);
|
|
647
669
|
}), t.push("");
|
|
648
|
-
}), t.pop(),
|
|
670
|
+
}), t.pop(), o.push(
|
|
649
671
|
`:root${e.type === "custom theme" ? `[data-theme='${new f(e.name).doKebabCase()}']` : ""} {
|
|
650
672
|
${t.join(`
|
|
651
673
|
`)}
|
|
652
674
|
}`
|
|
653
675
|
);
|
|
654
|
-
}),
|
|
676
|
+
}), o.join(`
|
|
655
677
|
|
|
656
678
|
`);
|
|
657
|
-
},
|
|
658
|
-
const r = c.themes.filter((
|
|
659
|
-
return r.forEach((
|
|
660
|
-
|
|
661
|
-
const
|
|
679
|
+
}, _ = (c) => {
|
|
680
|
+
const r = c.themes.filter((o) => o.type === "custom theme").length === 0 ? c.themes.filter((o) => o.type === "default theme") : c.themes.filter((o) => o.type === "custom theme"), s = [];
|
|
681
|
+
return r.forEach((o) => {
|
|
682
|
+
o.colors.forEach((h) => {
|
|
683
|
+
const a = h.shades.find((t) => t.type === "source color"), e = [];
|
|
662
684
|
e.push(
|
|
663
|
-
`// ${r[0].type === "custom theme" ?
|
|
685
|
+
`// ${r[0].type === "custom theme" ? o.name + " - " : ""}${h.name}`
|
|
664
686
|
), h.shades.reverse().forEach((t) => {
|
|
665
687
|
e.push(
|
|
666
|
-
`val ${r[0].type === "custom theme" ? new f(
|
|
688
|
+
`val ${r[0].type === "custom theme" ? new f(o.name + " " + h.name).doSnakeCase() : new f(h.name).doSnakeCase()}_${t.name} = Color(${t.isTransparent ? p((a == null ? void 0 : a.hex) ?? "#000000").alpha(t.alpha ?? 1).hex().replace("#", "0xFF").toUpperCase() : t.hex.replace("#", "0xFF").toUpperCase()})`
|
|
667
689
|
);
|
|
668
690
|
}), e.push(""), e.forEach((t) => s.push(t));
|
|
669
691
|
});
|
|
@@ -672,18 +694,18 @@ $modes: (`), s.filter((e) => e.type === "custom theme").forEach((e, t, l) => {
|
|
|
672
694
|
${s.join(`
|
|
673
695
|
`)}`;
|
|
674
696
|
};
|
|
675
|
-
class
|
|
697
|
+
class O {
|
|
676
698
|
constructor({
|
|
677
699
|
base: r,
|
|
678
700
|
themes: s,
|
|
679
|
-
meta:
|
|
701
|
+
meta: o
|
|
680
702
|
}) {
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
703
|
+
u(this, "base");
|
|
704
|
+
u(this, "themes");
|
|
705
|
+
u(this, "meta");
|
|
706
|
+
u(this, "paletteData");
|
|
707
|
+
u(this, "currentScale");
|
|
708
|
+
u(this, "makePaletteData", () => (this.themes.forEach((r) => {
|
|
687
709
|
const s = {
|
|
688
710
|
id: r.id,
|
|
689
711
|
name: r.name,
|
|
@@ -691,134 +713,134 @@ class D {
|
|
|
691
713
|
colors: [],
|
|
692
714
|
type: r.type
|
|
693
715
|
};
|
|
694
|
-
this.base.colors.forEach((
|
|
695
|
-
const h = Object.entries(r.scale).reverse().map((
|
|
696
|
-
if (
|
|
697
|
-
const m = new
|
|
716
|
+
this.base.colors.forEach((o) => {
|
|
717
|
+
const h = Object.entries(r.scale).reverse().map((n) => {
|
|
718
|
+
if (o.alpha.isEnabled) {
|
|
719
|
+
const m = new d({
|
|
698
720
|
render: "RGB",
|
|
699
721
|
sourceColor: [
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
722
|
+
o.rgb.r * 255,
|
|
723
|
+
o.rgb.g * 255,
|
|
724
|
+
o.rgb.b * 255
|
|
703
725
|
],
|
|
704
|
-
alpha: parseFloat((
|
|
705
|
-
hueShifting:
|
|
706
|
-
chromaShifting:
|
|
726
|
+
alpha: parseFloat((n[1] / 100).toFixed(2)),
|
|
727
|
+
hueShifting: o.hue.shift !== void 0 ? o.hue.shift : 0,
|
|
728
|
+
chromaShifting: o.chroma.shift !== void 0 ? o.chroma.shift : 100,
|
|
707
729
|
algorithmVersion: this.base.algorithmVersion,
|
|
708
730
|
visionSimulationMode: r.visionSimulationMode
|
|
709
|
-
}),
|
|
731
|
+
}), b = new d({
|
|
710
732
|
render: "RGB",
|
|
711
|
-
sourceColor: p(
|
|
733
|
+
sourceColor: p(o.alpha.backgroundColor).rgb(),
|
|
712
734
|
algorithmVersion: this.base.algorithmVersion,
|
|
713
735
|
visionSimulationMode: r.visionSimulationMode
|
|
714
736
|
});
|
|
715
737
|
switch (this.base.colorSpace) {
|
|
716
738
|
case "LCH":
|
|
717
739
|
return this.base.areSourceColorsLocked ? [
|
|
718
|
-
|
|
740
|
+
n,
|
|
719
741
|
m.setColorWithAlpha(),
|
|
720
|
-
|
|
742
|
+
b.setColorWithAlpha()
|
|
721
743
|
] : [
|
|
722
|
-
|
|
744
|
+
n,
|
|
723
745
|
m.lcha(),
|
|
724
|
-
|
|
746
|
+
b.lcha()
|
|
725
747
|
];
|
|
726
748
|
case "OKLCH":
|
|
727
749
|
return this.base.areSourceColorsLocked ? [
|
|
728
|
-
|
|
750
|
+
n,
|
|
729
751
|
m.setColorWithAlpha(),
|
|
730
|
-
|
|
752
|
+
b.setColorWithAlpha()
|
|
731
753
|
] : [
|
|
732
|
-
|
|
754
|
+
n,
|
|
733
755
|
m.oklcha(),
|
|
734
|
-
|
|
756
|
+
b.oklcha()
|
|
735
757
|
];
|
|
736
758
|
case "LAB":
|
|
737
759
|
return this.base.areSourceColorsLocked ? [
|
|
738
|
-
|
|
760
|
+
n,
|
|
739
761
|
m.setColorWithAlpha(),
|
|
740
|
-
|
|
762
|
+
b.setColorWithAlpha()
|
|
741
763
|
] : [
|
|
742
|
-
|
|
764
|
+
n,
|
|
743
765
|
m.laba(),
|
|
744
|
-
|
|
766
|
+
b.laba()
|
|
745
767
|
];
|
|
746
768
|
case "OKLAB":
|
|
747
769
|
return this.base.areSourceColorsLocked ? [
|
|
748
|
-
|
|
770
|
+
n,
|
|
749
771
|
m.setColorWithAlpha(),
|
|
750
|
-
|
|
772
|
+
b.setColorWithAlpha()
|
|
751
773
|
] : [
|
|
752
|
-
|
|
774
|
+
n,
|
|
753
775
|
m.oklaba(),
|
|
754
|
-
|
|
776
|
+
b.oklaba()
|
|
755
777
|
];
|
|
756
778
|
case "HSL":
|
|
757
779
|
return this.base.areSourceColorsLocked ? [
|
|
758
|
-
|
|
780
|
+
n,
|
|
759
781
|
m.setColorWithAlpha(),
|
|
760
|
-
|
|
782
|
+
b.setColorWithAlpha()
|
|
761
783
|
] : [
|
|
762
|
-
|
|
784
|
+
n,
|
|
763
785
|
m.hsla(),
|
|
764
|
-
|
|
786
|
+
b.hsla()
|
|
765
787
|
];
|
|
766
788
|
case "HSLUV":
|
|
767
789
|
return this.base.areSourceColorsLocked ? [
|
|
768
|
-
|
|
790
|
+
n,
|
|
769
791
|
m.setColorWithAlpha(),
|
|
770
|
-
|
|
792
|
+
b.setColorWithAlpha()
|
|
771
793
|
] : [
|
|
772
|
-
|
|
794
|
+
n,
|
|
773
795
|
m.hsluva(),
|
|
774
|
-
|
|
796
|
+
b.hsluva()
|
|
775
797
|
];
|
|
776
798
|
default:
|
|
777
|
-
return [
|
|
799
|
+
return [n, [0, 0, 0], [255, 255, 255]];
|
|
778
800
|
}
|
|
779
801
|
} else {
|
|
780
|
-
const m = new
|
|
802
|
+
const m = new d({
|
|
781
803
|
render: "RGB",
|
|
782
804
|
sourceColor: [
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
805
|
+
o.rgb.r * 255,
|
|
806
|
+
o.rgb.g * 255,
|
|
807
|
+
o.rgb.b * 255
|
|
786
808
|
],
|
|
787
|
-
lightness:
|
|
788
|
-
hueShifting:
|
|
789
|
-
chromaShifting:
|
|
809
|
+
lightness: n[1],
|
|
810
|
+
hueShifting: o.hue.shift !== void 0 ? o.hue.shift : 0,
|
|
811
|
+
chromaShifting: o.chroma.shift !== void 0 ? o.chroma.shift : 100,
|
|
790
812
|
algorithmVersion: this.base.algorithmVersion,
|
|
791
813
|
visionSimulationMode: r.visionSimulationMode
|
|
792
814
|
});
|
|
793
815
|
switch (this.base.colorSpace) {
|
|
794
816
|
case "LCH":
|
|
795
|
-
return [
|
|
817
|
+
return [n, m.lch()];
|
|
796
818
|
case "OKLCH":
|
|
797
|
-
return [
|
|
819
|
+
return [n, m.oklch()];
|
|
798
820
|
case "LAB":
|
|
799
|
-
return [
|
|
821
|
+
return [n, m.lab()];
|
|
800
822
|
case "OKLAB":
|
|
801
|
-
return [
|
|
823
|
+
return [n, m.oklab()];
|
|
802
824
|
case "HSL":
|
|
803
|
-
return [
|
|
825
|
+
return [n, m.hsl()];
|
|
804
826
|
case "HSLUV":
|
|
805
|
-
return [
|
|
827
|
+
return [n, m.hsluv()];
|
|
806
828
|
default:
|
|
807
|
-
return [
|
|
829
|
+
return [n, [0, 0, 0]];
|
|
808
830
|
}
|
|
809
831
|
}
|
|
810
|
-
}),
|
|
811
|
-
id:
|
|
812
|
-
name:
|
|
813
|
-
description:
|
|
832
|
+
}), a = {
|
|
833
|
+
id: o.id,
|
|
834
|
+
name: o.name,
|
|
835
|
+
description: o.description,
|
|
814
836
|
shades: [],
|
|
815
837
|
type: "color"
|
|
816
838
|
}, e = [
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
839
|
+
o.rgb.r * 255,
|
|
840
|
+
o.rgb.g * 255,
|
|
841
|
+
o.rgb.b * 255
|
|
820
842
|
], t = new C();
|
|
821
|
-
t.rgb_r =
|
|
843
|
+
t.rgb_r = o.rgb.r, t.rgb_g = o.rgb.g, t.rgb_b = o.rgb.b, t.rgbToHsluv(), a.shades.push({
|
|
822
844
|
name: "source",
|
|
823
845
|
description: "Source color",
|
|
824
846
|
hex: p(e).hex(),
|
|
@@ -837,73 +859,73 @@ class D {
|
|
|
837
859
|
type: "source color"
|
|
838
860
|
});
|
|
839
861
|
const l = h.map(
|
|
840
|
-
(
|
|
862
|
+
(n) => p.distance(
|
|
841
863
|
p(e).hex(),
|
|
842
|
-
p(
|
|
864
|
+
p(n[1]).hex(),
|
|
843
865
|
"rgb"
|
|
844
866
|
)
|
|
845
|
-
),
|
|
846
|
-
h.forEach((
|
|
847
|
-
const
|
|
867
|
+
), i = l.indexOf(Math.min(...l));
|
|
868
|
+
h.forEach((n, m) => {
|
|
869
|
+
const b = p.distance(
|
|
848
870
|
p(e).hex(),
|
|
849
|
-
p(
|
|
871
|
+
p(n[1]).hex(),
|
|
850
872
|
"rgb"
|
|
851
873
|
), x = Object.keys(this.currentScale).find(
|
|
852
|
-
(F) => F ===
|
|
853
|
-
) ?? "0",
|
|
874
|
+
(F) => F === n[0][0]
|
|
875
|
+
) ?? "0", $ = new C(), y = new d({
|
|
854
876
|
render: "RGB",
|
|
855
877
|
sourceColor: p(e).rgb(),
|
|
856
878
|
visionSimulationMode: r.visionSimulationMode
|
|
857
|
-
}).setColor(),
|
|
879
|
+
}).setColor(), g = new d({
|
|
858
880
|
render: "HEX",
|
|
859
881
|
sourceColor: p(e).rgb(),
|
|
860
882
|
visionSimulationMode: r.visionSimulationMode
|
|
861
883
|
}).setColor();
|
|
862
|
-
m ===
|
|
884
|
+
m === i && this.base.areSourceColorsLocked && !o.alpha.isEnabled ? ($.rgb_r = Number(y[0]) / 255, $.rgb_g = Number(y[1]) / 255, $.rgb_b = Number(y[2]) / 255) : ($.rgb_r = Number(n[1][0]) / 255, $.rgb_g = Number(n[1][1]) / 255, $.rgb_b = Number(n[1][2]) / 255), $.rgbToHsluv(), a.shades.push({
|
|
863
885
|
name: x,
|
|
864
|
-
description: `Shade/Tint color with ${typeof
|
|
865
|
-
hex: m ===
|
|
866
|
-
rgb: m ===
|
|
867
|
-
gl: m ===
|
|
868
|
-
lch: m ===
|
|
869
|
-
oklch: m ===
|
|
870
|
-
lab: m ===
|
|
871
|
-
oklab: m ===
|
|
872
|
-
hsl: m ===
|
|
873
|
-
hsluv: [
|
|
874
|
-
alpha:
|
|
875
|
-
backgroundColor:
|
|
876
|
-
mixedColor:
|
|
886
|
+
description: `Shade/Tint color with ${typeof n[0][1] == "number" ? n[0][1].toFixed(1) : n[0][1]}% of ${o.alpha.isEnabled ? "opacity" : "lightness"}`,
|
|
887
|
+
hex: m === i && this.base.areSourceColorsLocked && !o.alpha.isEnabled ? p(g).hex() : p(n[1]).hex(),
|
|
888
|
+
rgb: m === i && this.base.areSourceColorsLocked && !o.alpha.isEnabled ? p(g).rgb() : p(n[1]).rgb(),
|
|
889
|
+
gl: m === i && this.base.areSourceColorsLocked && !o.alpha.isEnabled ? p(g).gl() : p(n[1]).gl(),
|
|
890
|
+
lch: m === i && this.base.areSourceColorsLocked && !o.alpha.isEnabled ? p(g).lch() : p(n[1]).lch(),
|
|
891
|
+
oklch: m === i && this.base.areSourceColorsLocked && !o.alpha.isEnabled ? p(g).oklch() : p(n[1]).oklch(),
|
|
892
|
+
lab: m === i && this.base.areSourceColorsLocked && !o.alpha.isEnabled ? p(g).lab() : p(n[1]).lab(),
|
|
893
|
+
oklab: m === i && this.base.areSourceColorsLocked && !o.alpha.isEnabled ? p(g).oklab() : p(n[1]).oklab(),
|
|
894
|
+
hsl: m === i && this.base.areSourceColorsLocked && !o.alpha.isEnabled ? p(g).hsl() : p(n[1]).hsl(),
|
|
895
|
+
hsluv: [$.hsluv_h, $.hsluv_s, $.hsluv_l],
|
|
896
|
+
alpha: o.alpha.isEnabled ? parseFloat((n[0][1] / 100).toFixed(2)) : void 0,
|
|
897
|
+
backgroundColor: o.alpha.isEnabled && o.alpha.backgroundColor ? p(n[2]).rgb() : void 0,
|
|
898
|
+
mixedColor: o.alpha.isEnabled && o.alpha.backgroundColor ? new d({
|
|
877
899
|
visionSimulationMode: r.visionSimulationMode
|
|
878
900
|
}).mixColorsRgb(
|
|
879
901
|
[
|
|
880
|
-
...
|
|
902
|
+
...n[1],
|
|
881
903
|
parseFloat(
|
|
882
|
-
(
|
|
904
|
+
(n[0][1] / 100).toFixed(2)
|
|
883
905
|
)
|
|
884
906
|
],
|
|
885
|
-
[...
|
|
907
|
+
[...n[2], 1]
|
|
886
908
|
) : void 0,
|
|
887
|
-
isClosestToRef:
|
|
888
|
-
isSourceColorLocked: m ===
|
|
889
|
-
isTransparent:
|
|
909
|
+
isClosestToRef: b < 4 && !this.base.areSourceColorsLocked,
|
|
910
|
+
isSourceColorLocked: m === i && this.base.areSourceColorsLocked && !o.alpha.isEnabled,
|
|
911
|
+
isTransparent: o.alpha.isEnabled,
|
|
890
912
|
type: "color shade/tint"
|
|
891
913
|
});
|
|
892
|
-
}), s.colors.push(
|
|
914
|
+
}), s.colors.push(a);
|
|
893
915
|
}), this.paletteData.themes.push(s);
|
|
894
916
|
}), this.paletteData));
|
|
895
|
-
|
|
896
|
-
const
|
|
897
|
-
return
|
|
898
|
-
(
|
|
917
|
+
u(this, "makeLibraryData", (r, s) => {
|
|
918
|
+
const o = this.makePaletteData();
|
|
919
|
+
return o.themes.flatMap(
|
|
920
|
+
(a) => a.colors.flatMap(
|
|
899
921
|
(e) => e.shades.flatMap((t) => {
|
|
900
|
-
const l = `${
|
|
901
|
-
(
|
|
922
|
+
const l = `${a.id}:${e.id}:${t.name}`, i = s == null ? void 0 : s.find(
|
|
923
|
+
(n) => n.id === l
|
|
902
924
|
);
|
|
903
925
|
return {
|
|
904
926
|
id: l,
|
|
905
|
-
paletteName:
|
|
906
|
-
themeName:
|
|
927
|
+
paletteName: o.name,
|
|
928
|
+
themeName: a.name,
|
|
907
929
|
colorName: e.name,
|
|
908
930
|
shadeName: t.name,
|
|
909
931
|
...(r == null ? void 0 : r.includes("alpha")) && { alpha: t.alpha ?? 1 },
|
|
@@ -913,71 +935,75 @@ class D {
|
|
|
913
935
|
description: e.description
|
|
914
936
|
},
|
|
915
937
|
...(r == null ? void 0 : r.includes("collection_id")) && {
|
|
916
|
-
collectionId:
|
|
938
|
+
collectionId: i == null ? void 0 : i.collectionId
|
|
917
939
|
},
|
|
918
940
|
...(r == null ? void 0 : r.includes("mode_id")) && {
|
|
919
|
-
modeId:
|
|
941
|
+
modeId: i == null ? void 0 : i.modeId
|
|
920
942
|
},
|
|
921
943
|
...(r == null ? void 0 : r.includes("variable_id")) && {
|
|
922
|
-
variableId:
|
|
944
|
+
variableId: i == null ? void 0 : i.variableId
|
|
923
945
|
},
|
|
924
946
|
...(r == null ? void 0 : r.includes("style_id")) && {
|
|
925
|
-
styleId:
|
|
947
|
+
styleId: i == null ? void 0 : i.styleId
|
|
926
948
|
}
|
|
927
949
|
};
|
|
928
950
|
})
|
|
929
951
|
)
|
|
930
952
|
);
|
|
931
953
|
});
|
|
932
|
-
|
|
954
|
+
u(this, "makeNativeTokens", () => {
|
|
933
955
|
const r = this.makePaletteData();
|
|
934
|
-
return
|
|
956
|
+
return R(r);
|
|
935
957
|
});
|
|
936
|
-
|
|
958
|
+
u(this, "makeDtcgTokens", (r = "RGB") => {
|
|
937
959
|
const s = this.makePaletteData();
|
|
938
|
-
return
|
|
960
|
+
return K(s, r);
|
|
939
961
|
});
|
|
940
|
-
|
|
962
|
+
u(this, "makeStyleDictionaryTokens", () => {
|
|
941
963
|
const r = this.makePaletteData();
|
|
942
|
-
return
|
|
964
|
+
return H(r);
|
|
943
965
|
});
|
|
944
|
-
|
|
966
|
+
u(this, "makeUniversalJson", () => {
|
|
945
967
|
const r = this.makePaletteData();
|
|
946
968
|
return S(r);
|
|
947
969
|
});
|
|
948
|
-
|
|
970
|
+
u(this, "makeCssCustomProps", (r = "RGB") => {
|
|
949
971
|
const s = this.makePaletteData();
|
|
950
|
-
return
|
|
972
|
+
return G(s, r);
|
|
951
973
|
});
|
|
952
|
-
|
|
974
|
+
u(this, "makeScssVariable", (r = "RGB") => {
|
|
953
975
|
const s = this.makePaletteData();
|
|
954
|
-
return
|
|
976
|
+
return P(s, r);
|
|
955
977
|
});
|
|
956
|
-
|
|
978
|
+
u(this, "makeLessVariables", (r = "RGB") => {
|
|
957
979
|
const s = this.makePaletteData();
|
|
958
|
-
return
|
|
980
|
+
return B(s, r);
|
|
959
981
|
});
|
|
960
|
-
|
|
982
|
+
u(this, "makeTailwindConfig", () => {
|
|
961
983
|
const r = this.makePaletteData();
|
|
962
984
|
return L(r);
|
|
963
985
|
});
|
|
964
|
-
|
|
986
|
+
u(this, "makeSwiftUI", () => {
|
|
965
987
|
const r = this.makePaletteData();
|
|
966
|
-
return
|
|
988
|
+
return N(r);
|
|
967
989
|
});
|
|
968
|
-
|
|
990
|
+
u(this, "makeUIKit", () => {
|
|
969
991
|
const r = this.makePaletteData();
|
|
970
992
|
return T(r);
|
|
971
993
|
});
|
|
972
|
-
|
|
994
|
+
u(this, "makeCompose", () => {
|
|
973
995
|
const r = this.makePaletteData();
|
|
974
|
-
return
|
|
996
|
+
return _(r);
|
|
975
997
|
});
|
|
976
|
-
|
|
998
|
+
u(this, "makeResources", () => {
|
|
977
999
|
const r = this.makePaletteData();
|
|
978
|
-
return
|
|
1000
|
+
return A(r);
|
|
1001
|
+
});
|
|
1002
|
+
u(this, "makeCsv", () => {
|
|
1003
|
+
const r = this.makePaletteData();
|
|
1004
|
+
return j(r);
|
|
979
1005
|
});
|
|
980
|
-
|
|
1006
|
+
u(this, "makePaletteFullData", () => ({
|
|
981
1007
|
base: this.base,
|
|
982
1008
|
themes: this.themes,
|
|
983
1009
|
libraryData: this.makeLibraryData(),
|
|
@@ -986,15 +1012,15 @@ class D {
|
|
|
986
1012
|
type: "UI_COLOR_PALETTE"
|
|
987
1013
|
}));
|
|
988
1014
|
var h;
|
|
989
|
-
this.base = r, this.themes = s, this.meta =
|
|
1015
|
+
this.base = r, this.themes = s, this.meta = o, this.paletteData = {
|
|
990
1016
|
name: r.name ?? "UI Color Palette",
|
|
991
1017
|
description: r.description,
|
|
992
1018
|
themes: [],
|
|
993
1019
|
type: "palette"
|
|
994
|
-
}, this.currentScale = ((h = s.find((
|
|
1020
|
+
}, this.currentScale = ((h = s.find((a) => a.isEnabled)) == null ? void 0 : h.scale) ?? {};
|
|
995
1021
|
}
|
|
996
1022
|
}
|
|
997
1023
|
export {
|
|
998
|
-
|
|
1024
|
+
O as default
|
|
999
1025
|
};
|
|
1000
1026
|
//# sourceMappingURL=data.js.map
|