themes: Initial theme support

This commit is contained in:
Dylan Araps 2018-03-15 16:26:47 +11:00
parent da9226a8c4
commit cb3d53ee0c
2 changed files with 43 additions and 7 deletions

View File

@ -7,7 +7,7 @@ import shutil
import subprocess
import sys
from .settings import CACHE_DIR, COLOR_COUNT, __cache_version__
from .settings import CACHE_DIR, COLOR_COUNT, MODULE_DIR, __cache_version__
from . import util
@ -129,12 +129,23 @@ def get(img, cache_dir=CACHE_DIR,
def file(input_file):
"""Import colorscheme from json file."""
data = util.read_file_json(input_file)
theme_file = os.path.join(MODULE_DIR, "colorschemes",
".".join((input_file, "json")))
if "wallpaper" not in data:
data["wallpaper"] = "None"
if os.path.isfile(theme_file):
input_file = theme_file
if "alpha" not in data:
data["alpha"] = "100"
if os.path.isfile(input_file):
data = util.read_file_json(input_file)
return data
if "wallpaper" not in data:
data["wallpaper"] = "None"
if "alpha" not in data:
data["alpha"] = "100"
return data
else:
print("No colorscheme file found, exiting...")
sys.exit(1)

View File

@ -0,0 +1,25 @@
{
"special": {
"background": "#073642",
"foreground": "#fdf6e3",
"cursor": "#dc322f"
},
"colors": {
"color0": "#073642",
"color1": "#dc322f",
"color2": "#859900",
"color3": "#b58900",
"color4": "#268bd2",
"color5": "#d33682",
"color6": "#2aa198",
"color7": "#eee8d5",
"color8": "#6c7c80",
"color9": "#dc322f",
"color10": "#859900",
"color11": "#b58900",
"color12": "#268bd2",
"color13": "#d33682",
"color14": "#2aa198",
"color15": "#eee8d5"
}
}