xiwal

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

commit
8aea9eb34bff446afcef1e0402c136e67876d9b1
parent
ac6dc55b52b12b945dd031ecbaf4591dcbf5095b
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2026-02-19 12:28
lch: add support for 12 char hex

Diffstat

M xiwal/lch.py 6 +++++-

1 files changed, 5 insertions, 1 deletions


diff --git a/xiwal/lch.py b/xiwal/lch.py

@@ -121,7 +121,11 @@ def format_hex(rgb):
  121   121 
  122   122 def parse_hex(s):
  123   123     s = s.lstrip('#')
  124    -1     if len(s) == 6:
   -1   124     if len(s) == 12:
   -1   125         r = int(s[0:4], 16) / 257
   -1   126         g = int(s[4:8], 16) / 257
   -1   127         b = int(s[8:12], 16) / 257
   -1   128     elif len(s) == 6:
  125   129         r = int(s[0:2], 16)
  126   130         g = int(s[2:4], 16)
  127   131         b = int(s[4:6], 16)