feat: add procreate swatches

This commit is contained in:
winston 2022-12-29 20:24:58 +01:00
parent 3c2cdf21b4
commit a04bd7869c
No known key found for this signature in database
GPG key ID: 3786770EDBC2B481
5 changed files with 29 additions and 0 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

29
procreate/build.ts Executable file
View file

@ -0,0 +1,29 @@
#!/usr/bin/env deno run --allow-read --allow-write --allow-env
import { createSwatchesFile } from "npm:procreate-swatches";
const capitalize = (str: string) => str[0].toUpperCase() + str.slice(1);
type Color = {
hex: string;
rgb: string;
hsl: string;
};
type Palette = Record<string, Color>;
const library: Palette[] = JSON.parse(
await Deno.readTextFile("../palette.json")
);
for (const palette in library) {
const colours: Palette = library[palette];
const rgbValues = Object.values(colours).map((colour) => [
colour.rgb.match(/\d+/g),
"rgb",
]);
const name = `Catppuccin ${capitalize(palette)}`;
const data: ArrayBuffer = await createSwatchesFile(name, rgbValues);
Deno.writeFileSync(`./${name}.swatches`, new Uint8Array(data));
}