Skip to content

Commit

Permalink
feat(palettes): prefix filenames with "Catppuccin" (#92)
Browse files Browse the repository at this point in the history
  • Loading branch information
uncenter authored Sep 13, 2024
1 parent 311dacc commit cf765d2
Showing 1 changed file with 46 additions and 43 deletions.
89 changes: 46 additions & 43 deletions scripts/build_palettes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,53 +21,56 @@ await Promise.all(
);

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

await Deno.writeFile(
join(ROOT, `ase/${fname}.ase`),
generateAse(fname, colors),
);
await Deno.writeFile(
join(ROOT, `png/${fname}.png`),
generatePng(fname, colors),
);
await Deno.writeFile(
join(ROOT, `procreate/${fname}.swatches`),
await generateProcreate(fname, colors),
);
await Deno.writeTextFile(
join(ROOT, `gimp/${fname}.gpl`),
generateGimp(fname, colors),
);
await Deno.writeTextFile(
join(ROOT, `sip/${fname}.palette`),
generateSip(fname, colors),
);

if (Deno.env.get("COMPILE_APPLE_COLOR_LIST") === "1") {
const clrJson = join(ROOT, `clr/${fname}.json`);
await Deno.writeFile(
join(ROOT, `ase/Catppuccin ${nameWithoutAccent}.ase`),
generateAse(nameWithoutAccent, colors),
);
await Deno.writeFile(
join(ROOT, `png/Catppuccin ${nameWithoutAccent}.png`),
generatePng(nameWithoutAccent, colors),
);
await Deno.writeFile(
join(ROOT, `procreate/Catppuccin ${nameWithoutAccent}.swatches`),
await generateProcreate(nameWithoutAccent, colors),
);
await Deno.writeTextFile(
join(ROOT, `gimp/Catppuccin ${nameWithoutAccent}.gpl`),
generateGimp(nameWithoutAccent, colors),
);
await Deno.writeTextFile(
clrJson,
generateClrJson(fname, colors),
join(ROOT, `sip/Catppuccin ${nameWithoutAccent}.palette`),
generateSip(nameWithoutAccent, colors),
);

const cmd = new Deno.Command("swift", {
args: [
join(import.meta.dirname!, "./builders/palettes/json-to-clr.swift"),
if (Deno.env.get("COMPILE_APPLE_COLOR_LIST") === "1") {
const clrJson = join(ROOT, `clr/${nameWithoutAccent}.json`);
await Deno.writeTextFile(
clrJson,
join(ROOT, `clr/${name}.clr`),
],
});
const { code, stderr, stdout } = await cmd.output();
const td = new TextDecoder();
if (code === 0) {
console.log(td.decode(stdout).trim());
} else {
throw new Error(td.decode(stderr));
}
generateClrJson(nameWithoutAccent, colors),
);

const cmd = new Deno.Command("swift", {
args: [
join(import.meta.dirname!, "./builders/palettes/json-to-clr.swift"),
clrJson,
join(ROOT, `clr/Catppuccin ${nameWithAccent}.clr`),
],
});
const { code, stderr, stdout } = await cmd.output();
const td = new TextDecoder();
if (code === 0) {
console.log(td.decode(stdout).trim());
} else {
throw new Error(td.decode(stderr));
}

await Deno.remove(clrJson);
}
}),
await Deno.remove(clrJson);
}
},
),
).then(() => Deno.exit(0));

0 comments on commit cf765d2

Please sign in to comment.