Problem
Windows Terminal supports SIXEL, but does not correctly render a valid
full-color SIXEL stream that redefines palette entries between SIXEL bands.
This technique allows a single SIXEL image to contain far more than 256
colors: the encoder reuses the 256 palette registers for each six-pixel-high
band and redefines them before emitting the next band.
Minimal reproduction
Save this as sixel-repro.py and run it directly in Windows Terminal:
import sys
sys.stdout.buffer.write(
b"\x1bPq"
b'"1;1;2;12'
b"#1;2;100;0;0!2~"
b"$-"
b"#1;2;0;0;100!2~"
b"\x1b\\"
)
The first six-pixel band is red and the second one is blue.
Expected behavior
The upper band remains red and the lower band remains blue.
Actual behavior
The color of the earlier band may change when palette entry #1 is
redefined for the later band.
Technical background
The SIXEL format permits palette redefinition during a DCS sequence.
Implementations that support full-color SIXEL need to resolve the palette
color when pixels are decoded, or otherwise snapshot the RGB value before the
palette entry is changed.
This behavior is supported, for example, by
WezTerm
foot
Windows Terminal currently stores indexed pixels and resolves them against the
current color table when flushing the image, so earlier pixels can be affected
by later palette changes.
This is separate from support for multiple DCS images or layered SIXEL
images. The desired behavior is correct rendering of one DCS sequence.
Related: #20020
Problem
Windows Terminal supports SIXEL, but does not correctly render a valid
full-color SIXEL stream that redefines palette entries between SIXEL bands.
This technique allows a single SIXEL image to contain far more than 256
colors: the encoder reuses the 256 palette registers for each six-pixel-high
band and redefines them before emitting the next band.
Minimal reproduction
Save this as
sixel-repro.pyand run it directly in Windows Terminal:The first six-pixel band is red and the second one is blue.
Expected behavior
The upper band remains red and the lower band remains blue.
Actual behavior
The color of the earlier band may change when palette entry
#1isredefined for the later band.
Technical background
The SIXEL format permits palette redefinition during a DCS sequence.
Implementations that support full-color SIXEL need to resolve the palette
color when pixels are decoded, or otherwise snapshot the RGB value before the
palette entry is changed.
This behavior is supported, for example, by
WezTerm
foot
Windows Terminal currently stores indexed pixels and resolves them against the
current color table when flushing the image, so earlier pixels can be affected
by later palette changes.
This is separate from support for multiple DCS images or layered SIXEL
images. The desired behavior is correct rendering of one DCS sequence.
Related: #20020