mirror of
https://github.com/dylanaraps/pywal.git
synced 2025-02-13 00:39:56 +01:00
api: Added function to load colors from file.
This commit is contained in:
parent
a0c130cbda
commit
38fcae33a0
@ -91,7 +91,7 @@ def process_args(args):
|
|||||||
colors_plain = colors.get(image_file, notify=not args.q)
|
colors_plain = colors.get(image_file, notify=not args.q)
|
||||||
|
|
||||||
if args.f:
|
if args.f:
|
||||||
colors_plain = util.read_file_json(args.f)
|
colors_plain = colors.load(args.f)
|
||||||
|
|
||||||
if args.i or args.f:
|
if args.i or args.f:
|
||||||
sequences.send(colors_plain, args.t)
|
sequences.send(colors_plain, args.t)
|
||||||
|
@ -93,3 +93,13 @@ def get(img, cache_dir=__cache_dir__,
|
|||||||
util.msg("wal: Generation complete.", notify)
|
util.msg("wal: Generation complete.", notify)
|
||||||
|
|
||||||
return colors
|
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
|
||||||
|
@ -55,9 +55,6 @@ def read_file_json(input_file):
|
|||||||
with open(input_file, "r") as json_file:
|
with open(input_file, "r") as json_file:
|
||||||
data = json.load(json_file)
|
data = json.load(json_file)
|
||||||
|
|
||||||
if "wallpaper" not in data:
|
|
||||||
data["wallpaper"] = "None"
|
|
||||||
|
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user