summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDylan Araps <dylan.araps@gmail.com>2017-06-29 11:37:27 +1000
committerDylan Araps <dylan.araps@gmail.com>2017-06-29 11:37:27 +1000
commit8a908de48c5175e5eb41fe7d14a54adb50501405 (patch)
tree72e24414d1bc31846de0c9e8f5c67edfd50393d2
parent950400ef7de1b39c2ff1bcecabc0645b993f0b88 (diff)
colors: Store generated colors in a dict to later export to json.
-rwxr-xr-xpywal/__main__.py2
-rwxr-xr-xpywal/gen_colors.py20
2 files changed, 20 insertions, 2 deletions
diff --git a/pywal/__main__.py b/pywal/__main__.py
index 8f68387..2d22f3f 100755
--- a/pywal/__main__.py
+++ b/pywal/__main__.py
@@ -90,7 +90,7 @@ def process_args(args):
# Create a list of hex colors.
colors_plain = gen_colors.get_colors(image, args.q)
- colors_plain[8] = set_colors.set_grey(colors_plain)
+ # colors_plain[8] = set_colors.set_grey(colors_plain)
if not args.n:
wallpaper.set_wallpaper(image)
diff --git a/pywal/gen_colors.py b/pywal/gen_colors.py
index 3f5e16e..3814819 100755
--- a/pywal/gen_colors.py
+++ b/pywal/gen_colors.py
@@ -122,4 +122,22 @@ def get_colors(img, quiet):
def sort_colors(colors):
"""Sort the generated colors."""
- return colors[:1] + colors[9:] + colors[8:]
+ raw_colors = colors[:1] + colors[9:] + colors[8:]
+
+ # Special colors.
+ colors_special = {}
+ colors_special.update({"background": raw_colors[0]})
+ colors_special.update({"foreground": raw_colors[15]})
+ colors_special.update({"cursor": raw_colors[15]})
+
+ # Colors 0-15
+ colors_hex = {}
+ [colors_hex.update({f"color{index}": color}) # pylint: disable=W0106
+ for index, color in enumerate(raw_colors)]
+
+ # Add the colors to a dict.
+ colors = {}
+ colors["special"] = colors_special
+ colors["colors"] = colors_hex
+
+ return colors