summaryrefslogtreecommitdiff
path: root/pywal/colors.py
diff options
context:
space:
mode:
authorDylan Araps <dylan.araps@gmail.com>2018-03-15 16:26:47 +1100
committerDylan Araps <dylan.araps@gmail.com>2018-03-15 16:26:47 +1100
commitcb3d53ee0c2dc0f4132ec119b7e96d6c3c5d2266 (patch)
treee92219c456f058c8f96f6642f563d8896da6792b /pywal/colors.py
parentda9226a8c402a67bd31fc647fe888bdea3109b1f (diff)
themes: Initial theme support
Diffstat (limited to 'pywal/colors.py')
-rw-r--r--pywal/colors.py25
1 files changed, 18 insertions, 7 deletions
diff --git a/pywal/colors.py b/pywal/colors.py
index f47ac33..4bd3655 100644
--- a/pywal/colors.py
+++ b/pywal/colors.py
@@ -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)