Sixel icon indicating copy to clipboard operation
Sixel copied to clipboard

Add example how to check for SIXEL-capable terminal emulator

Open schrmh opened this issue 1 year ago • 1 comments

Thanks for creating this. It might serve well for cross-platform powershell scripts. However since there are multiple terminal emulators out there that do not support SIXEL I would like to know on how to detect them (and maybe also how many colors they support) and run alternative code if there is no support.

schrmh avatar Dec 25 '24 07:12 schrmh

Hello!

There is a builtin check for Sixel support.

Import-Module Sixel
[Sixel.Terminal.Compatibility]::TerminalSupportsSixel()

that's essentially just doing a DA1 check.

Unfortunately I'm not aware of a way to detect the amount of colors supported.

for Sixel it defaults to 256 colors.

But the module has support for InlineImageProtocol and a basic implementation of Kitty Graphics. you can test the different protocols with the -Protocol parameter. (the next version will include halfcell blocks as fallback)

the module does try and autoselect the appropriate protocol.. so it should run the alternative code automatically.

I'd like to take another pass at that logic at some point to make it a bit more robust.

there is an issue with the autoselection in WSL, but you can still do -Protocol Sixel -Force

trackd avatar Dec 27 '24 22:12 trackd