-
-
Notifications
You must be signed in to change notification settings - Fork 212
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 RGB SGR sequences (aka True Color) #306
Comments
Does ncurses support 16 million colors palette? |
Have you checked redefine_color command of sc-im? |
@andmarti1424 yes, ncurses supports true colors since 6.1 version. |
This was referenced May 17, 2020
Please try redefining colors after today's commit. |
This was added. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Would be nice to have the ability to use 16 million colors in themes, since most of the terminals supports it. See the summary taken from https://gist.github.com/XVilka/8346728
Colours in terminal
It's a common confusion about terminal colours... Actually we have this:
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 doesn't use a colour palette. They just specify the
colour itself.
Here's a test case:
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
Since ncurses-6.0-20180121 terminfo started to support 24-bit truecolor capability under the name of "RGB" - you need to use the "setaf" and "setab" commands to set foreground and background correspondingly.
Detection
There's no reliable way until the new release of terminfo/ncurses. After that the "RGB" flag should be available for detection. S-Lang author added a check for $COLORTERM containing either "truecolor" or "24bit" (case sensitive). In turn, VTE, Konsole and iTerm2 set this variable to "truecolor" (it's been there in VTE for a while, it's relatively new and maybe still git-only in Konsole and iTerm2).
This is obviously not a reliable method, and is not forwarded via sudo, ssh etc. However, whenever it errs, it errs on the safe side: does not advertise support whereas it's actually supported. App developers can freely choose to check for this same variable, or introduce their own method (e.g. an option in their config file), whichever matches better the overall design of the given app. Checking $COLORTERM is recommended though, since that would lead to a more unique desktop experience where the user has to set one variable only and it takes effect across all the apps, rather than something separately for each app.
Here are terminals discussions:
Now supporting truecolour
lscolors
to see a truecolor test)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:
Improper support for true colors
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
--truecolor
option)NOT supporting truecolour
Here are another console programs discussions:
Supporting True Colour:
ls
program that supports iconsNot supporting True Colour:
The text was updated successfully, but these errors were encountered: