mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-03-21 05:33:45 -04:00
generate-alt-random: emit multiple sixel bands
This ensures we’re getting the ‘$’ command PGO:d
This commit is contained in:
parent
ae86043780
commit
f8e51fcb17
1 changed files with 17 additions and 10 deletions
|
|
@ -165,7 +165,7 @@ def main():
|
||||||
# The sixel 'alphabet'
|
# The sixel 'alphabet'
|
||||||
sixels = '?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~'
|
sixels = '?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~'
|
||||||
|
|
||||||
for _ in range(200):
|
for _ in range(100):
|
||||||
# Offset image
|
# Offset image
|
||||||
out.write(' ' * (random.randrange(cols // 2)))
|
out.write(' ' * (random.randrange(cols // 2)))
|
||||||
|
|
||||||
|
|
@ -188,17 +188,24 @@ def main():
|
||||||
out.write(f'"1;1;{six_width};{six_height}')
|
out.write(f'"1;1;{six_width};{six_height}')
|
||||||
|
|
||||||
for row in range(six_height // 6): # Each sixel is 6 pixels
|
for row in range(six_height // 6): # Each sixel is 6 pixels
|
||||||
# Choose a random color
|
band_count = random.randrange(32)
|
||||||
out.write(f'#{random.randrange(256)}')
|
for band in range(band_count):
|
||||||
|
# Choose a random color
|
||||||
|
out.write(f'#{random.randrange(256)}')
|
||||||
|
|
||||||
if random.randrange(2):
|
if random.randrange(2):
|
||||||
for col in range(six_width):
|
for col in range(six_width):
|
||||||
out.write(f'{random.choice(sixels)}')
|
out.write(f'{random.choice(sixels)}')
|
||||||
else:
|
else:
|
||||||
out.write(f'!{six_width}{random.choice(sixels)}')
|
out.write(f'!{six_width}{random.choice(sixels)}')
|
||||||
|
|
||||||
# Next line
|
# Next line
|
||||||
out.write('-')
|
if band + 1 < band_count:
|
||||||
|
# Move cursor to beginning of current row
|
||||||
|
out.write('$')
|
||||||
|
elif row + 1 < six_height // 6:
|
||||||
|
# Newline
|
||||||
|
out.write('-')
|
||||||
|
|
||||||
# End sixel
|
# End sixel
|
||||||
out.write('\033\\')
|
out.write('\033\\')
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue