Skip to content

Sixel rendering with >256 colors #312

@unxed

Description

@unxed

First of all, spoiler: this image is rendered in Konsole with sixels, as you can see it has 2906 colors:

Image

Script that can do it (you need to install libsixel-bin for it to work):
sixel_colors.py

This script uses a technique known as tiling: dividing a single image into multiple stripes, each containing its own palette. This allows us to significantly increase the number of colors displayed. Older hardware terminals didn't allow this because they had a fixed palette of on-screen colors, but modern terminal emulators render the interface in truecolor mode and aren't constrained by this limitation! Therefore, we can output as many sixel images, each with its own palette, as we want.

We could go even further and use the transparency capabilities of sixel to sequentially output multiple images with different transparency masks and palettes to the same location. This would theoretically allow for full truecolor, but I haven't gotten around to implementing it yet.

You can also try cutting into little squares or rectangles instead of horizontal stripes, which is also a way to get TrueColor.

PS: chafa is great, thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureNew feature or requestqualityOutput qualityresearchResearch & discussion

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions