Skip to content

Commit

Permalink
ci: update palette workflow for @catppuccin/[email protected] (#570)
Browse files Browse the repository at this point in the history
  • Loading branch information
nekowinston authored Dec 28, 2023
1 parent c7cf3af commit b901cf1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
14 changes: 14 additions & 0 deletions .github/scripts/update-palette.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import json
import urllib.request

url = "https://github.com/catppuccin/palette/raw/main/palette.json"

with urllib.request.urlopen(url) as response:
flavors = json.loads(response.read().decode())

for flavor in flavors:
with open(f"lua/catppuccin/palettes/{flavor}.lua", "w") as f:
f.write("return {\n")
for color in flavors[flavor]["colors"]:
f.write(f'\t{color} = "{flavors[flavor]["colors"][color]["hex"]}",\n')
f.write("}\n")
11 changes: 1 addition & 10 deletions .github/workflows/palette.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,7 @@ jobs:
- uses: actions/checkout@v3

- name: Make changes to pull request
run: |
curl -o /tmp/palette.json https://raw.githubusercontent.com/catppuccin/palette/main/palette.json
python -c "import json
data = json.load(open('/tmp/palette.json'))
for flavour in data:
with open('lua/catppuccin/palettes/{flavour}.lua'.format(flavour = flavour), 'w') as f:
f.write('return {\n')
for accent in data[flavour]: f.write('\t{accent} = \"{hex}\",\n'.format(accent = accent, hex = data[flavour][accent]['hex']))
f.write('}\n')"
run: python3 ./.github/scripts/update-palette.py

- name: Create Pull Request
id: cpr
Expand Down

0 comments on commit b901cf1

Please sign in to comment.