colors: Use an ordered dict to store the colors.

This commit is contained in:
Dylan Araps 2017-08-10 00:40:19 +10:00
parent 0b8e6749f3
commit c9f0ad2921

View File

@ -1,6 +1,7 @@
""" """
Generate a colorscheme using imagemagick. Generate a colorscheme using imagemagick.
""" """
import collections
import re import re
import shutil import shutil
import subprocess import subprocess
@ -64,19 +65,17 @@ def sort_colors(img, colors):
# Create a comment color from the background. # Create a comment color from the background.
raw_colors[8] = util.lighten_color(raw_colors[0], 0.40) raw_colors[8] = util.lighten_color(raw_colors[0], 0.40)
colors = {"wallpaper": img} colors = {}
colors_special = {} colors["wallpaper"] = img
colors_hex = {} colors["special"] = {}
colors["colors"] = collections.OrderedDict()
colors_special.update({"background": raw_colors[0]}) colors["special"]["background"] = raw_colors[0]
colors_special.update({"foreground": raw_colors[15]}) colors["special"]["foreground"] = raw_colors[15]
colors_special.update({"cursor": raw_colors[15]}) colors["special"]["cursor"] = raw_colors[15]
for index, color in enumerate(raw_colors): for index, color in enumerate(raw_colors):
colors_hex.update({"color%s" % index: color}) colors["colors"]["color%s" % index] = color
colors["special"] = colors_special
colors["colors"] = colors_hex
return colors return colors