diff options
| author | Dylan Araps <dylan.araps@gmail.com> | 2017-06-19 17:46:22 +1000 |
|---|---|---|
| committer | Dylan Araps <dylan.araps@gmail.com> | 2017-06-19 17:46:22 +1000 |
| commit | eb1adc0e4f4726e9a80a099f3f552e096baf353b (patch) | |
| tree | 337d4b95ffd38773bf753f24d71987fcae4d5bbc | |
| parent | b17ba1a4f2631ae64da8965d30b10555fb19b2b9 (diff) | |
Optimization: Cleanup get_grey
| -rwxr-xr-x[-rw-r--r--] | wal.py | 31 |
1 files changed, 13 insertions, 18 deletions
@@ -1,3 +1,4 @@ +#!/usr/bin/env python """ wal - Generate and change colorschemes on the fly. Created by Dylan Araps @@ -215,24 +216,18 @@ def set_color(index, color): def get_grey(color, color2): """Set a grey color based on brightness of color0""" - brightness = int(color[1]) - - if 0 <= brightness <= 1: - return "#666666" - - elif brightness == 2: - return "#757575" - - elif 3 <= brightness <= 4: - return "#999999" - - elif brightness == 5: - return "#8a8a8a" - - elif 6 <= brightness <= 9: - return "#a1a1a1" - - return color2 + return { + 0: "#666666", + 1: "#666666", + 2: "#757575", + 3: "#999999", + 4: "#999999", + 5: "#8a8a8a", + 6: "#a1a1a1", + 7: "#a1a1a1", + 8: "#a1a1a1", + 9: "#a1a1a1", + }.get(int(color[1]), color2) def send_sequences(colors, vte): |
