mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-24 01:40:12 -05:00
generate-alt-random: don’t skip that last partial row
This commit is contained in:
parent
0bc98877f3
commit
660a7f9345
1 changed files with 3 additions and 2 deletions
|
|
@ -180,6 +180,7 @@ def main():
|
||||||
|
|
||||||
out.write(f'\033[{last_pos[0]};{last_pos[1]}H')
|
out.write(f'\033[{last_pos[0]};{last_pos[1]}H')
|
||||||
six_height, six_width = last_size
|
six_height, six_width = last_size
|
||||||
|
six_rows = (six_height + 5) // 6 # Round up; each sixel is 6 pixels
|
||||||
|
|
||||||
# Begin sixel
|
# Begin sixel
|
||||||
out.write('\033Pq')
|
out.write('\033Pq')
|
||||||
|
|
@ -195,7 +196,7 @@ def main():
|
||||||
# (except 'hue' which is 0..360)
|
# (except 'hue' which is 0..360)
|
||||||
out.write(f'#{idx};2;{random.randrange(101)};{random.randrange(101)};{random.randrange(101)}')
|
out.write(f'#{idx};2;{random.randrange(101)};{random.randrange(101)};{random.randrange(101)}')
|
||||||
|
|
||||||
for row in range(six_height // 6): # Each sixel is 6 pixels
|
for row in range(six_rows):
|
||||||
band_count = random.randrange(32)
|
band_count = random.randrange(32)
|
||||||
for band in range(band_count):
|
for band in range(band_count):
|
||||||
# Choose a random color
|
# Choose a random color
|
||||||
|
|
@ -211,7 +212,7 @@ def main():
|
||||||
if band + 1 < band_count:
|
if band + 1 < band_count:
|
||||||
# Move cursor to beginning of current row
|
# Move cursor to beginning of current row
|
||||||
out.write('$')
|
out.write('$')
|
||||||
elif row + 1 < six_height // 6:
|
elif row + 1 < six_rows:
|
||||||
# Newline
|
# Newline
|
||||||
out.write('-')
|
out.write('-')
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue