- commit
- be2cb26a6cd536b3cae241a0c5025753ea5cfca1
- parent
- 26feb2ee9c8a121fe3b666cfec06a1b82b59fc4c
- Author
- Tobias Bengfort <tobias.bengfort@posteo.de>
- Date
- 2026-02-19 12:33
refactor: use f-strings
Diffstat
| M | xiwal/lch.py | 2 | +- |
| M | xiwal/term.py | 12 | ++++++------ |
2 files changed, 7 insertions, 7 deletions
diff --git a/xiwal/lch.py b/xiwal/lch.py
@@ -134,7 +134,7 @@ def parse_hex(s): 134 134 g = int(s[1], 16) * 17 135 135 b = int(s[2], 16) * 17 136 136 else:137 -1 raise ValueError('Invalid hex color: %s' % s)-1 137 raise ValueError(f'Invalid hex color: {s}') 138 138 return r, g, b 139 139 140 140
diff --git a/xiwal/term.py b/xiwal/term.py
@@ -11,16 +11,16 @@ def apply(scheme, cachefile='~/.cache/wal/sequences'): 11 11 for path in [cachefile, *glob.glob('/dev/pts/[0-9]*')]: 12 12 with open(path, 'w') as tty: 13 13 for i in range(16):14 -1 tty.write('\033]4;%i;%s\033\\' % (i, scheme[i]))15 -1 tty.write('\033]%i;%s\033\\' % (11, scheme[0]))16 -1 tty.write('\033]%i;%s\033\\' % (10, scheme[15]))-1 14 tty.write(f'\033]4;{i};{scheme[i]}\033\\') -1 15 tty.write(f'\033]11;{scheme[0]}\033\\') -1 16 tty.write(f'\033]10;{scheme[15]}\033\\') 17 17 18 18 19 19 def palette(scheme): 20 20 s = [] 21 21 for i in range(16): 22 22 r, g, b = lch.parse_hex(scheme[i])23 -1 s.append('\033[48;2;%i;%i;%im \033[0m' % (r, g, b))-1 23 s.append(f'\033[48;2;{r};{g};{b}m \033[0m') 24 24 print(''.join(s[:8])) 25 25 print(''.join(s[8:])) 26 26 @@ -35,7 +35,7 @@ def palette_256(scheme): 35 35 for z in range(6): 36 36 for x in range(6): 37 37 r, g, b = lch.parse_hex(scheme[16 + 36 * y + 6 * z + x])38 -1 line.append('\033[48;2;%i;%i;%im \033[0m' % (r, g, b))-1 38 line.append(f'\033[48;2;{r};{g};{b}m \033[0m') 39 39 line.append(' ') 40 40 print(''.join(line)) 41 41 @@ -44,5 +44,5 @@ def palette_256(scheme): 44 44 line = [] 45 45 for i in range(24): 46 46 r, g, b = lch.parse_hex(scheme[232 + i])47 -1 line.append('\033[48;2;%i;%i;%im \033[0m' % (r, g, b))-1 47 line.append(f'\033[48;2;{r};{g};{b}m \033[0m') 48 48 print(''.join(line))