Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(palettes): prefix filenames with "Catppuccin" #92

Merged
merged 3 commits into from
Sep 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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));