-
-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: build script, fix latte colors
- Loading branch information
1 parent
d2c401d
commit 6e78c70
Showing
5 changed files
with
1,451 additions
and
1,356 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,147 @@ | ||
#!/usr/bin/env -S deno run --allow-write --allow-env | ||
import { variants } from "https://esm.sh/@catppuccin/palette@0.1.5"; | ||
import Handlebars from "https://esm.sh/handlebars@4.7.7"; | ||
|
||
const template = `<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
{{#each color}} | ||
<key>{{key}}</key> | ||
<dict> | ||
<key>Color Space</key> | ||
<string>sRGB</string> | ||
<key>Red Component</key> | ||
<real>{{col.red}}</real> | ||
<key>Green Component</key> | ||
<real>{{col.green}}</real> | ||
<key>Blue Component</key> | ||
<real>{{col.blue}}</real> | ||
<key>Alpha Component</key> | ||
<real>1</real> | ||
</dict> | ||
{{/each}} | ||
</dict> | ||
</plist>`; | ||
|
||
for (let [flavour, colors] of Object.entries(variants)) { | ||
const isLatte = flavour === "latte"; | ||
|
||
colors = Object.fromEntries( | ||
Object.entries(colors).map(([key, value]) => { | ||
const [red, green, blue] = [ | ||
value.hex.slice(1, 3), | ||
value.hex.slice(3, 5), | ||
value.hex.slice(5, 7), | ||
].map((v) => parseInt(v, 16) / 255); | ||
return [key, { red, green, blue }]; | ||
}), | ||
); | ||
const termcolor = [ | ||
{ | ||
key: "Ansi 0 Color", | ||
col: isLatte ? colors.subtext1 : colors.surface1, | ||
}, | ||
{ | ||
key: "Ansi 1 Color", | ||
col: colors.red, | ||
}, | ||
{ | ||
key: "Ansi 2 Color", | ||
col: colors.green, | ||
}, | ||
{ | ||
key: "Ansi 3 Color", | ||
col: colors.yellow, | ||
}, | ||
{ | ||
key: "Ansi 4 Color", | ||
col: colors.blue, | ||
}, | ||
{ | ||
key: "Ansi 5 Color", | ||
col: colors.pink, | ||
}, | ||
{ | ||
key: "Ansi 6 Color", | ||
col: colors.teal, | ||
}, | ||
{ | ||
key: "Ansi 7 Color", | ||
col: isLatte ? colors.surface2 : colors.subtext1, | ||
}, | ||
{ | ||
key: "Ansi 8 Color", | ||
col: isLatte ? colors.subtext0 : colors.surface2, | ||
}, | ||
{ | ||
key: "Ansi 9 Color", | ||
col: colors.red, | ||
}, | ||
{ | ||
key: "Ansi 10 Color", | ||
col: colors.green, | ||
}, | ||
{ | ||
key: "Ansi 11 Color", | ||
col: colors.yellow, | ||
}, | ||
{ | ||
key: "Ansi 12 Color", | ||
col: colors.blue, | ||
}, | ||
{ | ||
key: "Ansi 13 Color", | ||
col: colors.pink, | ||
}, | ||
{ | ||
key: "Ansi 14 Color", | ||
col: colors.teal, | ||
}, | ||
{ | ||
key: "Ansi 15 Color", | ||
col: isLatte ? colors.surface1 : colors.subtext0, | ||
}, | ||
{ | ||
key: "Background Color", | ||
col: colors.base, | ||
}, | ||
{ | ||
key: "Foreground Color", | ||
col: colors.text, | ||
}, | ||
{ | ||
key: "Link Color", | ||
col: colors.sky, | ||
}, | ||
{ | ||
key: "Bold Color", | ||
col: colors.text, | ||
}, | ||
{ | ||
key: "Cursor Color", | ||
col: colors.rosewater, | ||
}, | ||
{ | ||
key: "Cursor Text Color", | ||
col: colors.text, | ||
}, | ||
{ | ||
key: "Cursor Guide Color", | ||
col: colors.rosewater, | ||
}, | ||
{ | ||
key: "Selection Color", | ||
col: colors.rosewater, | ||
}, | ||
{ | ||
key: "Selected Text Color", | ||
col: colors.crust, | ||
}, | ||
]; | ||
const compiled = Handlebars.compile(template); | ||
Deno.writeTextFileSync( | ||
`./colors/catppuccin-${flavour}.itermcolors`, | ||
compiled({ color: termcolor }), | ||
); | ||
} |
Oops, something went wrong.