Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

term: add functions for detecting Sixel support + example #21665

Merged

Conversation

larpon
Copy link
Contributor

@larpon larpon commented Jun 11, 2024

This adds 2 functions (and an example) to the term module that can query the terminal's graphics attributes.
One for detecting Sixel support and one for how many color registers the graphics device has in use. The later is useful if you later want to try to set a higher number of colors, depending on how many colors the Sixel image have.

Running the example in a Sixel compatible terminal should look something like this:

Konsole:
image

Xterm in vt340 mode:
image

Vanilla xterm needs this in ~/.Xresources:

xterm*decTerminalID: vt340
xterm*numColorRegisters: 256
xterm*sixelScrolling: 1
xterm*sixelScrollsRight: 1

To apply run: xrdb -merge ~/.Xresources

Terminal Sixel support is tracked here: https://www.arewesixelyet.com

ImageMagick can convert regular images to sixel format, if you want to play around:

convert image.png sixel:- > image.six # ImageMagick < v7
magick image.png sixel:- > image.six # ImageMagick >= v7

Bonus tip: it also works over ssh

@spytheman spytheman merged commit 47e93d1 into vlang:master Jun 11, 2024
64 checks passed
@larpon larpon deleted the term/add-support-for-detecting-sixel-graphics branch June 11, 2024 20:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants