mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-04 04:06:06 -05:00
scripts: generate-alt-random-writes: mix new/old-style RGB escapes
This commit is contained in:
parent
66527b39b1
commit
5aa97189df
1 changed files with 8 additions and 1 deletions
|
|
@ -92,8 +92,15 @@ def main():
|
|||
|
||||
elif color_variant == ColorVariant.RGB:
|
||||
do_bg = rand.read(1)[0] % 2
|
||||
base = 48 if do_bg else 38
|
||||
rgb = rand.read(3)
|
||||
out.write(f'\033[{48 if do_bg else 38}:2::{rgb[0]}:{rgb[1]}:{rgb[2]}m')
|
||||
|
||||
if rand.read(1)[0] % 2:
|
||||
# Old-style
|
||||
out.write(f'\033[{base};2;{rgb[0]};{rgb[1]};{rgb[2]}m')
|
||||
else:
|
||||
# New-style (sub-parameter based)
|
||||
out.write(f'\033[{base}:2::{rgb[0]}:{rgb[1]}:{rgb[2]}m')
|
||||
|
||||
out.write(c * repeat)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue