forked from aome510/spotify-player
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy paththeme_parse
executable file
·53 lines (45 loc) · 1.54 KB
/
theme_parse
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/python
import sys
import requests
import toml
if len(sys.argv) > 1:
name = sys.argv[1]
if len(sys.argv) > 2:
saved_name = sys.argv[2]
else:
saved_name = name
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}.toml"
req = requests.get(url)
if req.status_code != 200:
print(
f"GET {url} request failed with status code: {req.status_code}", file=sys.stderr
)
exit(1)
data = toml.loads(req.text)
print(
f"""[[themes]]
name = "{saved_name}"
[themes.palette]
background = "{data["colors"]["primary"]["background"]}"
foreground = "{data["colors"]["primary"]["foreground"]}"
black = "{data["colors"]["normal"]["black"]}"
red = "{data["colors"]["normal"]["red"]}"
green = "{data["colors"]["normal"]["green"]}"
yellow = "{data["colors"]["normal"]["yellow"]}"
blue = "{data["colors"]["normal"]["blue"]}"
magenta = "{data["colors"]["normal"]["magenta"]}"
cyan = "{data["colors"]["normal"]["cyan"]}"
white = "{data["colors"]["normal"]["white"]}"
bright_black = "{data["colors"]["bright"]["black"]}"
bright_red = "{data["colors"]["bright"]["red"]}"
bright_green = "{data["colors"]["bright"]["green"]}"
bright_yellow = "{data["colors"]["bright"]["yellow"]}"
bright_blue = "{data["colors"]["bright"]["blue"]}"
bright_magenta = "{data["colors"]["bright"]["magenta"]}"
bright_cyan = "{data["colors"]["bright"]["cyan"]}"
bright_white = "{data["colors"]["bright"]["white"]}"
"""
)