Skip to content

Commit cf765d2

Browse files
authoredSep 13, 2024··
feat(palettes): prefix filenames with "Catppuccin" (#92)
1 parent 311dacc commit cf765d2

File tree

1 file changed

+46
-43
lines changed

1 file changed

+46
-43
lines changed
 

‎scripts/build_palettes.ts

+46-43
Original file line numberDiff line numberDiff line change
@@ -21,53 +21,56 @@ await Promise.all(
2121
);
2222

2323
Promise.all(
24-
Object.entries(flavors).flatMap(async ([identifier, { name, colors }]) => {
25-
const fname = identifier.charAt(0).toUpperCase() + identifier.slice(1);
24+
Object.entries(flavors).flatMap(
25+
async ([identifier, { name: nameWithAccent, colors }]) => {
26+
const nameWithoutAccent = identifier.charAt(0).toUpperCase() +
27+
identifier.slice(1);
2628

27-
await Deno.writeFile(
28-
join(ROOT, `ase/${fname}.ase`),
29-
generateAse(fname, colors),
30-
);
31-
await Deno.writeFile(
32-
join(ROOT, `png/${fname}.png`),
33-
generatePng(fname, colors),
34-
);
35-
await Deno.writeFile(
36-
join(ROOT, `procreate/${fname}.swatches`),
37-
await generateProcreate(fname, colors),
38-
);
39-
await Deno.writeTextFile(
40-
join(ROOT, `gimp/${fname}.gpl`),
41-
generateGimp(fname, colors),
42-
);
43-
await Deno.writeTextFile(
44-
join(ROOT, `sip/${fname}.palette`),
45-
generateSip(fname, colors),
46-
);
47-
48-
if (Deno.env.get("COMPILE_APPLE_COLOR_LIST") === "1") {
49-
const clrJson = join(ROOT, `clr/${fname}.json`);
29+
await Deno.writeFile(
30+
join(ROOT, `ase/Catppuccin ${nameWithoutAccent}.ase`),
31+
generateAse(nameWithoutAccent, colors),
32+
);
33+
await Deno.writeFile(
34+
join(ROOT, `png/Catppuccin ${nameWithoutAccent}.png`),
35+
generatePng(nameWithoutAccent, colors),
36+
);
37+
await Deno.writeFile(
38+
join(ROOT, `procreate/Catppuccin ${nameWithoutAccent}.swatches`),
39+
await generateProcreate(nameWithoutAccent, colors),
40+
);
41+
await Deno.writeTextFile(
42+
join(ROOT, `gimp/Catppuccin ${nameWithoutAccent}.gpl`),
43+
generateGimp(nameWithoutAccent, colors),
44+
);
5045
await Deno.writeTextFile(
51-
clrJson,
52-
generateClrJson(fname, colors),
46+
join(ROOT, `sip/Catppuccin ${nameWithoutAccent}.palette`),
47+
generateSip(nameWithoutAccent, colors),
5348
);
5449

55-
const cmd = new Deno.Command("swift", {
56-
args: [
57-
join(import.meta.dirname!, "./builders/palettes/json-to-clr.swift"),
50+
if (Deno.env.get("COMPILE_APPLE_COLOR_LIST") === "1") {
51+
const clrJson = join(ROOT, `clr/${nameWithoutAccent}.json`);
52+
await Deno.writeTextFile(
5853
clrJson,
59-
join(ROOT, `clr/${name}.clr`),
60-
],
61-
});
62-
const { code, stderr, stdout } = await cmd.output();
63-
const td = new TextDecoder();
64-
if (code === 0) {
65-
console.log(td.decode(stdout).trim());
66-
} else {
67-
throw new Error(td.decode(stderr));
68-
}
54+
generateClrJson(nameWithoutAccent, colors),
55+
);
56+
57+
const cmd = new Deno.Command("swift", {
58+
args: [
59+
join(import.meta.dirname!, "./builders/palettes/json-to-clr.swift"),
60+
clrJson,
61+
join(ROOT, `clr/Catppuccin ${nameWithAccent}.clr`),
62+
],
63+
});
64+
const { code, stderr, stdout } = await cmd.output();
65+
const td = new TextDecoder();
66+
if (code === 0) {
67+
console.log(td.decode(stdout).trim());
68+
} else {
69+
throw new Error(td.decode(stderr));
70+
}
6971

70-
await Deno.remove(clrJson);
71-
}
72-
}),
72+
await Deno.remove(clrJson);
73+
}
74+
},
75+
),
7376
).then(() => Deno.exit(0));

0 commit comments

Comments
 (0)
Please sign in to comment.