Optimization: Cleanup get_grey

This commit is contained in:
Dylan Araps 2017-06-19 17:46:22 +10:00
parent b17ba1a4f2
commit eb1adc0e4f

31
wal.py Normal file → Executable file
View File

@ -1,3 +1,4 @@
#!/usr/bin/env python
""" """
wal - Generate and change colorschemes on the fly. wal - Generate and change colorschemes on the fly.
Created by Dylan Araps Created by Dylan Araps
@ -215,24 +216,18 @@ def set_color(index, color):
def get_grey(color, color2): def get_grey(color, color2):
"""Set a grey color based on brightness of color0""" """Set a grey color based on brightness of color0"""
brightness = int(color[1]) return {
0: "#666666",
if 0 <= brightness <= 1: 1: "#666666",
return "#666666" 2: "#757575",
3: "#999999",
elif brightness == 2: 4: "#999999",
return "#757575" 5: "#8a8a8a",
6: "#a1a1a1",
elif 3 <= brightness <= 4: 7: "#a1a1a1",
return "#999999" 8: "#a1a1a1",
9: "#a1a1a1",
elif brightness == 5: }.get(int(color[1]), color2)
return "#8a8a8a"
elif 6 <= brightness <= 9:
return "#a1a1a1"
return color2
def send_sequences(colors, vte): def send_sequences(colors, vte):