-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvariables.py
More file actions
23 lines (23 loc) · 1005 Bytes
/
variables.py
File metadata and controls
23 lines (23 loc) · 1005 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
def get_variables():
light_variables_dict = {}
dark_variables_dict = {}
f = open("./variables.txt")
content = f.read()
variables = content.split("\n")
light_theme_variables = variables[0 : variables.index(':root[data-theme="dark"] {')]
dark_theme_variables = variables[variables.index(':root[data-theme="dark"] {') :]
for line in light_theme_variables:
if line.startswith(":root") or line == "}" or line == "{" or line == "":
continue
name, hex = line.split(":")
light_variables_dict[name.replace(" ", "").lstrip("-")] = hex.replace(
";", ""
).replace("#", "")
for line in dark_theme_variables:
if line.startswith(":root") or line == "}" or line == "{" or line == "":
continue
name, hex = line.split(":")
dark_variables_dict[name.replace(" ", "").lstrip("-")] = hex.replace(
";", ""
).replace("#", "")
return [light_variables_dict, dark_variables_dict]