mirror of
https://github.com/dylanaraps/pywal.git
synced 2025-01-23 22:38:36 +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
|
||||
|
||||
|
||||
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):
|
||||
"""Import colorscheme from json file."""
|
||||
theme_name = ".".join((input_file, "json"))
|
||||
@ -52,19 +69,7 @@ def file(input_file):
|
||||
|
||||
# Parse the theme file.
|
||||
if os.path.isfile(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
|
||||
return parse_theme(theme_file)
|
||||
|
||||
else:
|
||||
print("No colorscheme file found, exiting...")
|
||||
|
Loading…
Reference in New Issue
Block a user