diff options
| author | Dylan Araps <dylan.araps@gmail.com> | 2017-07-23 14:51:42 +1000 |
|---|---|---|
| committer | Dylan Araps <dylan.araps@gmail.com> | 2017-07-23 14:51:42 +1000 |
| commit | 38fcae33a09fae218fff7211725e3781f287f5a6 (patch) | |
| tree | 2690eff5dbce718af7ebabedbd7ec979feb3e6d0 | |
| parent | a0c130cbdaad332473d8c7ef573059e46fa189f9 (diff) | |
api: Added function to load colors from file.
| -rw-r--r-- | pywal/__main__.py | 2 | ||||
| -rw-r--r-- | pywal/colors.py | 10 | ||||
| -rw-r--r-- | pywal/util.py | 3 |
3 files changed, 11 insertions, 4 deletions
diff --git a/pywal/__main__.py b/pywal/__main__.py index 36cec51..44663df 100644 --- a/pywal/__main__.py +++ b/pywal/__main__.py @@ -91,7 +91,7 @@ def process_args(args): colors_plain = colors.get(image_file, notify=not args.q) if args.f: - colors_plain = util.read_file_json(args.f) + colors_plain = colors.load(args.f) if args.i or args.f: sequences.send(colors_plain, args.t) diff --git a/pywal/colors.py b/pywal/colors.py index 08490a4..0ede3e1 100644 --- a/pywal/colors.py +++ b/pywal/colors.py @@ -93,3 +93,13 @@ def get(img, cache_dir=__cache_dir__, util.msg("wal: Generation complete.", notify) return colors + + +def file(input_file): + """Import colorscheme from json file.""" + data = util.read_file_json(input_file) + + if "wallpaper" not in data: + data["wallpaper"] = "None" + + return data diff --git a/pywal/util.py b/pywal/util.py index 6338989..1df3c9f 100644 --- a/pywal/util.py +++ b/pywal/util.py @@ -55,9 +55,6 @@ def read_file_json(input_file): with open(input_file, "r") as json_file: data = json.load(json_file) - if "wallpaper" not in data: - data["wallpaper"] = "None" - return data |
