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

Support for True Color (16 millions colors) #227

Open
XVilka opened this issue Jan 10, 2014 · 7 comments
Open

Support for True Color (16 millions colors) #227

XVilka opened this issue Jan 10, 2014 · 7 comments
Labels
component:terminal Ncurses and terminal

Comments

@XVilka
Copy link

XVilka commented Jan 10, 2014

Now more terminals bring support for 16 million colors (see references below).

Here's a test case for terminal:

printf "\x1b[${bg};2;${red};${green};${blue}m\n"

The 256 colour palete is configured at start, and it's a 666 cube of
colours, each of them defined as a 24bit (888 rgb) colour.

This means that current support can only display 256 different colours
in the terminal, while truecolour means that you can display 16 milion
different colours at the same time.

Truecolour escape codes doesnt uses a colour palete. It just specifies the
colour itself.

Here's a test case:

printf "\x1b[38;2;255;100;0mTRUECOLOR\x1b[0m\n"
awk 'BEGIN{
    s="/\\/\\/\\/\\/\\"; s=s s s s s s s s;
    for (colnum = 0; colnum<77; colnum++) {
        r = 255-(colnum*255/76);
        g = (colnum*510/76);
        b = (colnum*255/76);
        if (g>255) g = 510-g;
        printf "\033[48;2;%d;%d;%dm", r,g,b;
        printf "\033[38;2;%d;%d;%dm", 255-r,255-g,255-b;
        printf "%s\033[0m", substr(s,colnum+1,1);
    }
    printf "\n";
}'

Keep in mind that it is possible to use both ';' and ':' as parameters delimiter.

According to Wikipedia[1], this is only supported by xterm and konsole.

[1] https://en.wikipedia.org/wiki/ANSI_color

Currently, there is no support for the 24-bit colour descriptions in the terminfo/termcap database and utilites.
See the discussion thread here: https://lists.gnu.org/archive/html/bug-ncurses/2013-10/msg00007.html

Here are terminals discussions:

Now supporting truecolour

But there are bunch of libvte-based terminals for GTK2 so they are listed in the another section.

Also, while this one is not exactly a terminal, but a terminal replayer, it still worth mentioning:

Parsing ANSI colour sequences, but approximating them to 256 palette

Note about colour differences: a) RGB axes are not orthogonal, so you cannot use sqrt(R^2+G^2+B^2) formula, b) for colour differences there is more correct (but much more complex) CIEDE2000 formula (which may easily blow up performance if used blindly) [2].

[2] neovim/neovim#793 (comment)

Terminal multiplexers

NOT supporting truecolour

[3] You can download patched version here https://github.com/rdebath/PuTTY

[4] You can download patched version here https://github.com/halcy/PuTTY

Here are another console programs discussions:

Supporting True Colour:

Not supporting True Colour:

@ZyX-I
Copy link

ZyX-I commented Jan 10, 2014

Provided bug number for konsole is incorrect: correct one is https://bugs.kde.org/show_bug.cgi?id=107487.

@XVilka
Copy link
Author

XVilka commented Jan 10, 2014

@ZyX-I thx! fixed.

@jonas
Copy link
Owner

jonas commented Jan 10, 2014

Unless ncurses supports True Color, it sounds like it will take a lot of work to get Tig to support it.

@XVilka
Copy link
Author

XVilka commented Feb 7, 2018

@jonas starting from version 6.1 ncurses supports this mode.

@jonas
Copy link
Owner

jonas commented Feb 7, 2018

@XVilka That's great news, thanks for the update.

@jmera
Copy link

jmera commented Aug 1, 2018

@jonas is this going to be picked up at some point? This would be a pretty nice feature.

@spidey
Copy link

spidey commented Feb 23, 2020

What is the purpose of adding RGB support to tig? Is it only for specifying theme colors with more control/options?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:terminal Ncurses and terminal
Projects
None yet
Development

No branches or pull requests

5 participants