util: Fix set_grey type mismatch.

This commit is contained in:
Dylan Araps 2017-07-01 19:45:53 +10:00
parent 0f6b48523c
commit 0425f1d8aa
2 changed files with 14 additions and 14 deletions

View File

@ -10,9 +10,6 @@ from pywal import util
def template(colors, input_file, output_dir):
"""Read template file, substitute markers and
save the file elsewhere."""
# Get the template name.
template_file = os.path.basename(input_file)
# Import the template.
with open(input_file) as file:
template_data = file.readlines()
@ -20,6 +17,9 @@ def template(colors, input_file, output_dir):
# Format the markers.
template_data = "".join(template_data).format(**colors)
# Get the template name.
template_file = os.path.basename(input_file)
# Export the template.
output_file = output_dir / template_file
util.save_file(template_data, output_file)

View File

@ -25,17 +25,17 @@ class Color(object):
def set_grey(colors):
"""Set a grey color based on brightness of color0."""
return {
0: "#666666",
1: "#666666",
2: "#757575",
3: "#999999",
4: "#999999",
5: "#8a8a8a",
6: "#a1a1a1",
7: "#a1a1a1",
8: "#a1a1a1",
9: "#a1a1a1",
}.get(int(colors[0][1]), colors[7])
"0": "#666666",
"1": "#666666",
"2": "#757575",
"3": "#999999",
"4": "#999999",
"5": "#8a8a8a",
"6": "#a1a1a1",
"7": "#a1a1a1",
"8": "#a1a1a1",
"9": "#a1a1a1",
}.get(colors[0][1], colors[7])
def read_file(input_file):