summaryrefslogtreecommitdiff
path: root/pywal/util.py
diff options
context:
space:
mode:
authorDylan Araps <dylan.araps@gmail.com>2017-06-29 10:54:42 +1000
committerDylan Araps <dylan.araps@gmail.com>2017-06-29 10:54:42 +1000
commit1734129dea39e7292910553598fa5f751a819085 (patch)
tree0cbf02f6287b9e76bff0b5df07bbdff74fd55ad8 /pywal/util.py
parent06d726a66cec0c5626c31975397ab340349ff39b (diff)
colors: Add support for importing colors in a json format.
Diffstat (limited to 'pywal/util.py')
-rwxr-xr-xpywal/util.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/pywal/util.py b/pywal/util.py
index 67baa6a..415b612 100755
--- a/pywal/util.py
+++ b/pywal/util.py
@@ -1,6 +1,7 @@
"""
Misc helper functions.
"""
+import json
import os
import pathlib
import subprocess
@@ -13,6 +14,13 @@ def read_file(input_file):
return colors
+def read_file_json(input_file):
+ """Read colors from a json file."""
+ with open(input_file) as json_file:
+ colors = json.load(json_file)
+ return colors
+
+
def save_file(colors, export_file):
"""Write the colors to the file."""
with open(export_file, "w") as file: