bakkeby / st-flexipatch

An st build with preprocessor directives to decide which patches to include during build time
MIT License
347 stars 107 forks source link

sixel: add support for fully transparent bg (P2=1) #132

Closed veltza closed 4 months ago

veltza commented 4 months ago

P2 selects how the terminal draws the background color.

P2                  Meaning
0 or 2 (default)    Pixel positions specified as 0 are set to the
                    current background color.
1                   Pixel positions specified as 0 remain at their
                    current color.

Both modes are now supported.

Ref. https://www.vt100.net/docs/vt3xx-gp/chapter14.html

veltza commented 4 months ago

Here are two example sixels that use P2=1 mode.

Before, when P2=1 was not supported, the background was rendered with the current background color, so it looks like transparent, but it is opaque. (P2=0|2 works like this btw)

eyes-before

Now that P2=1 is supported, the background is fully transparent.

eyes-after

Since other terminals don't support this feature properly or at all, tools like chafa and convert don't use it, which is a shame. But I wanted to implement it anyway because it was one of the missing features.

step- commented 4 months ago

@veltza, A picture is worth a thousand words. Very nice!

bakkeby commented 4 months ago

Somehow you manage to make this look like it is simple. This is impressive.