From cf7aec9800d8bb11bae1ded5471e032022ec4d87 Mon Sep 17 00:00:00 2001 From: Sebastian Rollen Date: Mon, 19 Aug 2024 21:49:07 -0400 Subject: [PATCH] modify theme script to parse toml --- docs/config.md | 2 +- scripts/theme_parse | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/config.md b/docs/config.md index b85024fe..4bf2e58b 100644 --- a/docs/config.md +++ b/docs/config.md @@ -171,7 +171,7 @@ A theme has three main components: `name` (the theme's name), `palette` (the the ### Use script to add theme -[a `theme_parse` python script](../scripts/theme_parse) (require `pyaml` and `requests` libraries) can be used to parse [Iterm2 alacritty's color schemes](https://github.com/mbadolato/iTerm2-Color-Schemes/tree/master/alacritty) into a `spotify_player` compatible theme format. +[a `theme_parse` python script](../scripts/theme_parse) (require `toml` and `requests` libraries) can be used to parse [Iterm2 alacritty's color schemes](https://github.com/mbadolato/iTerm2-Color-Schemes/tree/master/alacritty) into a `spotify_player` compatible theme format. For example, you can run diff --git a/scripts/theme_parse b/scripts/theme_parse index cd70537e..70e56f19 100755 --- a/scripts/theme_parse +++ b/scripts/theme_parse @@ -2,7 +2,7 @@ import sys import requests -import yaml +import toml if len(sys.argv) > 1: name = sys.argv[1] @@ -15,7 +15,7 @@ else: print("Usage: theme_parse `theme_name` `theme_saved_name`", file=sys.stderr) exit(1) -url = f"https://raw.githubusercontent.com/mbadolato/iTerm2-Color-Schemes/master/alacritty/{name}.yml" +url = f"https://raw.githubusercontent.com/mbadolato/iTerm2-Color-Schemes/master/alacritty/{name}.toml" req = requests.get(url) @@ -25,7 +25,7 @@ if req.status_code != 200: ) exit(1) -data = yaml.safe_load(req.content) +data = toml.loads(req.text) print( f"""[[themes]]