Skip to content

Commit

Permalink
ci: update palette workflow for @catppuccin/[email protected]
Browse files Browse the repository at this point in the history
  • Loading branch information
nekowinston committed Aug 22, 2023
1 parent b573866 commit bc9472e
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/v0.3.0/palette.json"

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

for flavor in flavors:
with open(f"lua/catppuccin/palettes/{flavor}.lua", "w") as f:
f.write("return {\n")
for accent in flavors[flavor]:
f.write(f'\t{accent} = "{flavors[flavor][accent]["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 bc9472e

Please sign in to comment.