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

True Color support in both GUI and console application #59

Closed
XVilka opened this issue Feb 22, 2014 · 15 comments · Fixed by #2198
Closed

True Color support in both GUI and console application #59

XVilka opened this issue Feb 22, 2014 · 15 comments · Fixed by #2198
Labels

Comments

@XVilka
Copy link

XVilka commented Feb 22, 2014

See the support/patches for original VIm https://bitbucket.org/ZyX_I/vim/commits/branch/24-bit-xterm
Also, ncurses is not going to have support for that (thanks its author!).
And now it is supported by major part of terminal applications.
Here is the addition info about true colors:

Colors in terminal

It's a common confusion about terminal colors... Actually we have this:

  • plain ascii
  • ansi escape codes (16 color codes with bold/italic and background)
  • 256 color palette (216 colors+16gray + ansi) (colors are 24bit)
  • 24bit true color (888 colors (aka 16 milion))

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

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

Truecolor escape codes doesnt uses a color palete. It just specifies the
color itself.

Here's a test case:

printf "\x1b[38;2;255;100;0mTRUECOLOR\x1b[0m\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

Here are terminals discussions:

Now supporting truecolor

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

Parsing ANSI color 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] #793 (comment)

NOT supporting truecolor

Terminal multiplexers

[3] Currently you can use tmux_escape option as a workaround if you want true color in shell run under tmux. No true color in tmux statusline though.

Here are another console programs discussions:

Supporting True Color:

Not supporting True Color:


Want to back this issue? Place a bounty on it! We accept bounties via Bountysource.

@tarruda
Copy link
Member

tarruda commented Feb 22, 2014

@XVilka these concerns will go in other projects. neovim will simply emit color information embedded in msgpack objects, its up to the UI to parse those and display to the user in whatever way it can.

After the msgpack UI is finished, a new project for hosting a ncurses UI will be created.

@leonerd
Copy link
Contributor

leonerd commented Apr 4, 2014

I should also add that my own libvterm / pangoterm also supports the standard SGR 38:2:rrr:ggg:bbb format for RGB8 colour handling.
http://www.leonerd.org.uk/code/libvterm/
http://www.leonerd.org.uk/code/pangoterm/

@justinmk justinmk reopened this Aug 26, 2014
@justinmk
Copy link
Member

@leonerd Would it be reasonable to use libvterm as a replacement for ncurses, or is it lower level?

Does anyone have experience with termbox?

slang (better ncurses alternative)

slang is probably not an option since it's GPL: http://www.jedsoft.org/slang/

@leonerd
Copy link
Contributor

leonerd commented Aug 26, 2014

@leonerd Would it be reasonable to use libvterm as a replacement for ncurses, or is it lower level?

I think you mean libtickit. :) But yes; it's quite similar.

For neovim you'll likely want to use the highest layer that currently exists in the C library; the renderbuffer layer. See http://home.leonerd.org.uk/code/libtickit/doc/tickit_renderbuffer.7.html.

At some point later, I may have a porting of the Window layer from the Perl library. This will help manage rendering nested/overlapping/etc.. regions using the renderbuffer, and routes input events via focus management. Some of those issues might not be important for neovim - maybe renderbuffer will be sufficient.

@justinmk
Copy link
Member

@leonerd Good info as usual, thanks.

@ZyX-I
Copy link
Contributor

ZyX-I commented Aug 26, 2014

@leonerd I am wondering whether you support incompatible 38;2;r*;g*;b*? Konsole does not support colons there and semicolons are supported by almost all terminals. Or is there any way to automatically deduce what format (colons/semicolons) is supported (e.g. via terminfo)?

It may appear that somebody (libtickit?) will have to write a set of hacks just to answer the last question.

@ZyX-I
Copy link
Contributor

ZyX-I commented Aug 26, 2014

@leonerd By the way, why this list:

A full set of terminal rendering attributes; bold, italics_, underline, reverse, strikethough_, alternate font*

is lacking blink attribute (echo -e "Normal \e[5mBlink", is supported by xterm)? It is super useful for making user mad and fix blinking as fast as possible! And it can be emulated if needed.

@leonerd
Copy link
Contributor

leonerd commented Aug 26, 2014

@ZyX-I I suspect the choice of colon or semicolon format for SGR colours can be determined by using DECRQSS on SGR, and parsing the result. This is also handy for detecting if the terminal supports 256 palette or 24bit RGB8 modes in the first place. I'll see what I can come up with; though in the short term I doubt I'll manage to get very much in.

As to the lack of blink, that's an easy one to add - it's just another set of bits on top of what it already has.

@leonerd
Copy link
Contributor

leonerd commented Sep 6, 2014

@ZyX-I libtickit now supports blink, as of last night.

@Gaelan
Copy link
Contributor

Gaelan commented Sep 6, 2014

No Terminal.app support either.

@sebroeder
Copy link

Now that the new tui has been merged, what else is needed to support true color nvim in the terminal?

@tarruda
Copy link
Member

tarruda commented Mar 19, 2015

Now that the new tui has been merged, what else is needed to support true color nvim in the terminal?

This PR 😄

@sebroeder
Copy link

This is awesome @tarruda, thank you so much! I wanted to donate to the Neovim project for a long time and this it the perfect opportunity 😄

@grawity
Copy link

grawity commented Feb 1, 2016

Linux v3.13 parses and discards extended color codes: torvalds/linux@3415097

Linux v3.16 translates them to the closest VGA color: torvalds/linux@cec5b2a

tmux v2.2 appears to have gained support: ThomasAdam/tmux@427b820

dwb pushed a commit to dwb/neovim that referenced this issue Feb 21, 2017
…_file

Do not use 'cat' to create a temp file.
@valpackett
Copy link

yeah it works in tmux now, please update the list

jamessan added a commit to jamessan/neovim that referenced this issue Jan 1, 2019
    $ LC_ALL=en_US.UTF-8 MANROFFSEQ='' MANWIDTH=80 man --warnings -E UTF-8 -l -Tutf8 -Z man/nvim.1 >/dev/null
    mdoc warning: A .Bl directive has no matching .El (neovim#59)
butwerenotthereyet pushed a commit to butwerenotthereyet/neovim that referenced this issue Dec 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants