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