mirror of
https://github.com/dylanaraps/pywal.git
synced 2025-01-24 06:48:41 +01:00
theme: cleanup
This commit is contained in:
parent
2bd4c7b75b
commit
ae13cae6f8
@ -30,6 +30,23 @@ def terminal_sexy_to_wal(data):
|
|||||||
return data
|
return data
|
||||||
|
|
||||||
|
|
||||||
|
def parse_theme(theme_file):
|
||||||
|
"""Parse the theme file."""
|
||||||
|
data = util.read_file_json(theme_file)
|
||||||
|
|
||||||
|
if "wallpaper" not in data:
|
||||||
|
data["wallpaper"] = "None"
|
||||||
|
|
||||||
|
if "alpha" not in data:
|
||||||
|
data["alpha"] = "100"
|
||||||
|
|
||||||
|
# Terminal.sexy format.
|
||||||
|
if "color" in data:
|
||||||
|
data = terminal_sexy_to_wal(data)
|
||||||
|
|
||||||
|
return data
|
||||||
|
|
||||||
|
|
||||||
def file(input_file):
|
def file(input_file):
|
||||||
"""Import colorscheme from json file."""
|
"""Import colorscheme from json file."""
|
||||||
theme_name = ".".join((input_file, "json"))
|
theme_name = ".".join((input_file, "json"))
|
||||||
@ -52,19 +69,7 @@ def file(input_file):
|
|||||||
|
|
||||||
# Parse the theme file.
|
# Parse the theme file.
|
||||||
if os.path.isfile(theme_file):
|
if os.path.isfile(theme_file):
|
||||||
data = util.read_file_json(theme_file)
|
return parse_theme(theme_file)
|
||||||
|
|
||||||
if "wallpaper" not in data:
|
|
||||||
data["wallpaper"] = "None"
|
|
||||||
|
|
||||||
if "alpha" not in data:
|
|
||||||
data["alpha"] = "100"
|
|
||||||
|
|
||||||
# Terminal.sexy format.
|
|
||||||
if "color" in data:
|
|
||||||
data = terminal_sexy_to_wal(data)
|
|
||||||
|
|
||||||
return data
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
print("No colorscheme file found, exiting...")
|
print("No colorscheme file found, exiting...")
|
||||||
|
Loading…
Reference in New Issue
Block a user