colors: Store generated colors in a dict to later export to json.

This commit is contained in:
Dylan Araps 2017-06-29 11:37:27 +10:00
parent 950400ef7d
commit 8a908de48c
2 changed files with 20 additions and 2 deletions

View File

@ -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)

View File

@ -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