Skip to content

Commit

Permalink
build: pin palette.json tag
Browse files Browse the repository at this point in the history
  • Loading branch information
nekowinston committed Aug 22, 2023
1 parent e9001cf commit f2dccc2
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions build.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@
import urllib.request

def main():
with urllib.request.urlopen('https://github.com/raw/catppuccin/palette/main/palette.json') as f:
with urllib.request.urlopen('https://github.com/raw/catppuccin/palette/v0.2.0/palette.json') as f:
data = f.read().decode('utf-8')
colors = json.loads(data)

for theme in ["latte", "frappe", "macchiato", "mocha"]:
# create mapping
colormap = {}
for color in colors["macchiato"]:
colormap[colors["macchiato"][color]["hex"]] = colors[theme][color]["hex"]

# delete old files
for file in os.listdir(f"themes/catppuccin-{theme}"):
if file.endswith(".png"):
Expand All @@ -29,12 +29,12 @@ def main():
svg = svg.replace(color, colormap[color])
with open("tmp.svg", "w") as tmp:
tmp.write(svg)

if file == "preview.svg":
os.system(f'convert -background none "tmp.svg" "assets/{theme}.png"')
else:
os.system(f'convert -background none "tmp.svg" "themes/catppuccin-{theme}/{file.removesuffix(".svg")}.png"')

# cleanup
os.remove("tmp.svg")

Expand All @@ -46,4 +46,4 @@ def main():
os.system("python3 -m catwalk -o assets/mocha.png assets/mocha.png assets/mocha.png assets/mocha.png assets/mocha.png")

if __name__ == "__main__":
main()
main()

0 comments on commit f2dccc2

Please sign in to comment.