xiwal

Generate terminal color schemes
git clone https://git.ce9e.org/xiwal.git

commit
58402d3779c4589f1afe7e9d16da710edd30b7e3
parent
f9dafb6dca0fc126a3ba2164b0e0ced26a219fae
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2019-11-15 08:32
include black/white lightness in L_DARK/L_LIGHT

Diffstat

M wal/scheme.py 16 ++++++++--------

1 files changed, 8 insertions, 8 deletions


diff --git a/wal/scheme.py b/wal/scheme.py

@@ -10,8 +10,8 @@ C_RG = 60
   10    10 # - dark kcolors should have sufficient contrast to both black and white
   11    11 # - light colors should have different levels of lightness so they can
   12    12 #   easily be distinguished
   13    -1 L_DARK = 45, 50, 50, 45, 45, 50
   14    -1 L_LIGHT = 60, 70, 80, 60, 60, 75
   -1    13 L_DARK = 2, 45, 50, 50, 45, 45, 50, 85
   -1    14 L_LIGHT = 20, 60, 70, 80, 60, 60, 75, 100
   15    15 
   16    16 # hue for red reference color
   17    17 OFFSET = math.pi * 2 / 15
@@ -46,21 +46,21 @@ def score(colors):
   46    46 def scheme(colors, dominant):
   47    47 	c_grey = min(dominant[1], 8)
   48    48 
   49    -1 	yield 2, c_grey, dominant[2]
   -1    49 	yield L_DARK[0], c_grey, dominant[2]
   50    50 	for i in range(6):
   51    51 		c = colors[i][1] * 1.2
   52    52 		if i in [0, 1]:
   53    53 			c = max(c, C_RG)
   54    -1 		yield L_DARK[i], c, colors[i][2]
   55    -1 	yield 85, c_grey, dominant[2]
   -1    54 		yield L_DARK[i + 1], c, colors[i][2]
   -1    55 	yield L_DARK[7], c_grey, dominant[2]
   56    56 
   57    -1 	yield 20, c_grey, dominant[2]
   -1    57 	yield L_LIGHT[0], c_grey, dominant[2]
   58    58 	for i in range(6):
   59    59 		c = colors[i][1] * 1.2
   60    60 		if i in [0, 1]:
   61    61 			c = max(c, C_RG)
   62    -1 		yield L_LIGHT[i], c, colors[i][2]
   63    -1 	yield 100, c_grey, dominant[2]
   -1    62 		yield L_LIGHT[i + 1], c, colors[i][2]
   -1    63 	yield L_LIGHT[7], c_grey, dominant[2]
   64    64 
   65    65 
   66    66 def colors2scheme(colors):