- commit
- 86bfb53524a9ce618754912c349f258291752443
- parent
- 988a9d4298297d03e977b473821177578e1d1f4a
- Author
- Tobias Bengfort <tobias.bengfort@posteo.de>
- Date
- 2019-11-14 11:14
set minimum saturation for red/green important signal colors in diffs or alerts
Diffstat
| M | xiwal.py | 16 | +++++++++++++--- |
1 files changed, 13 insertions, 3 deletions
diff --git a/xiwal.py b/xiwal.py
@@ -5,6 +5,7 @@ import subprocess 5 5 import sys 6 6 7 7 WHITE = (95.05, 100, 108.9) -1 8 C_BG = 60 8 9 9 10 10 11 def _srgb2rgb(c): @@ -130,9 +131,12 @@ def permutate(a, n): 130 131 def distance(color, i, offset=math.pi * 2 / 12): 131 132 hue = math.pi / 3 * i + offset 132 133 d = abs(color[2] - hue) -1 134 c = color[1] -1 135 if i in [0, 1]: -1 136 c = max(c, C_BG) 133 137 if d > math.pi: 134 138 d = 2 * math.pi - d135 -1 return d ** 2 * color[1]-1 139 return d ** 2 * c 136 140 137 141 138 142 def score(colors): @@ -148,12 +152,18 @@ def scheme(colors, dominant): 148 152 149 153 yield 2, c_grey, dominant[2] 150 154 for i in range(6):151 -1 yield l_dark[i], colors[i][1] * 1.2, colors[i][2]-1 155 c = colors[i][1] * 1.2 -1 156 if i in [0, 1]: -1 157 c = max(c, C_BG) -1 158 yield l_dark[i], c, colors[i][2] 152 159 yield 90, c_grey, dominant[2] 153 160 154 161 yield 20, c_grey, dominant[2] 155 162 for i in range(6):156 -1 yield l_light[i], colors[i][1] * 1.2, colors[i][2]-1 163 c = colors[i][1] * 1.2 -1 164 if i in [0, 1]: -1 165 c = max(c, C_BG) -1 166 yield l_light[i], c, colors[i][2] 157 167 yield 100, c_grey, dominant[2] 158 168 159 169