Support 24-bit color in terminal #81

Closed
ZyX-I opened this Issue Jan 20, 2013 · 21 comments

Projects

None yet

5 participants

@ZyX-I
Contributor
ZyX-I commented Jan 20, 2013

There is ISO-8613-3 standard for 24-bit color in terminals: \e[38;2;{R};{G};{B}m (foreground, 48 for background) ({R},{G},{B} are decimal integers from 0 to 255). Currently it is fully supported only* by konsole and partially** in xterm. On Windows there is support for this in ConEmu. I am working on supporting this in vim (it will use guifg/guibg attributes in terminal). Working version, bookmark 24-bit-xterm. Does not work if you try to compile with gui support enabled.

Issue is not urgent, but nice-to-have. I will probably look at it later as it should be easy to add.

* Checked all terminals that have at least one stable version in Gentoo main portage tree.

** Uses nearest color from 8-bit palette.

@Lokaltog
Member

I really, really want this after switching to Konsole. I'm thinking about adding a 24bit_terminal option in config.json that is false by default, but when enabled automatically uses 24-bit colors in all the renderers. Is this the correct patch for enabling 24-bit color support in vim?

@ZyX-I
Contributor
ZyX-I commented Jan 24, 2013

@Lokaltog Nope, it or its parent* is the correct revision. I am not thinking about creating any patches until I want to send the whole thing to vim-dev thus there is no single diff you can apply to get it working.

* Its parent was known to work successful without gui, this commit just was not tested without gui and fails with it.

@Lokaltog
Member

I don't use the GUI and the parent compiled without any problems, excellent job. Finally GUI colorschemes in the terminal!

@Lokaltog Lokaltog closed this in 16b82cf Jan 25, 2013
@ZyX-I
Contributor
ZyX-I commented Jan 26, 2013

@Lokaltog Latest revision also works, seems I forgot to recompile.

@Lokaltog
Member

I actually couldn't compile the latest revision, I received a compile error
with one of the xterm color functions. I figured it had something to do
with your macro updates so I tried the parent and it worked.

Kim Silkebækken

On 26. jan. 2013, at 20:08, ZyX-I notifications@github.com wrote:

@Lokaltog https://github.com/Lokaltog Latest revision also works, seems I
forgot to recompile.


Reply to this email directly or view it on
GitHubhttps://github.com/Lokaltog/powerline/issues/81#issuecomment-12740320.

@ZyX-I
Contributor
ZyX-I commented Jan 26, 2013

It is a two-line fix and everything works (pushed). More interesting is why I need to set Normal after setting &guicolors group in order to get it highlighted properly. After I figure it out patch will be ready.

@ArnisL
ArnisL commented May 31, 2013

Bit unrelated, but anyone knows if there is any progress for tmux to support true colors?

@ZyX-I
Contributor
ZyX-I commented May 31, 2013

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.

@ArnisL
ArnisL commented May 31, 2013

@ZyX-I more details on how to do that would be great. Sorry to bother you.

@ArnisL
ArnisL commented Oct 31, 2013

@ZyX-I wanted to ask - what's about vim version 7.4?
particularly - is there a version that's patched for 24 bit colors?

P.s. haven't found better way to contact you
P.p.s. there's gist I created for tmux to recognize 24 bit colors: https://gist.github.com/ArnisL/6156593

@ZyX-I
Contributor
ZyX-I commented Oct 31, 2013

I periodically merge this branch with upstream. Much more often I merge with upstream local-default which as well has 24 bit support merged in. AFAIK there are no conflicts. All development goes in https://bitbucket.org/ZyX_I/vim, branch or bookmark you need is named xterm-(something).

There is and will be no precompiled binaries created by me.

31.10.13, 13:22, "Arnis Lapsa" notifications@github.com":

@ZyX-I wanted to ask - what's about vim version 7.4?
particularly - is there a version that's patched for 24 bit colors?
P.s. haven't found better way to contact you
P.p.s. there's gist I created for tmux to recognize 24 bit colors: https://gist.github.com/ArnisL/6156593

Reply to this email directly or view it on GitHub.

@ArnisL
ArnisL commented Feb 20, 2014

@ZyX-I somehow i cannot get any 7.4 version to work with 24bit colors. managed that with 'hg clone -r dd91804 vim vim_24bit', but that's kind an old revision.

@ZyX-I
Contributor
ZyX-I commented Feb 20, 2014

@ArnisL “Somehowe I cannot get any 7.4 version to work” does not look like enough information to make me able to help. You must describe what you have tried and what that resulted in.

@xanderdunn

@ZyX-I May I ask if your vim truecolor support has made it into vim upstream?

@ZyX-I
Contributor
ZyX-I commented Dec 29, 2014

@alexdunn You can check this yourself: guicolors option is responsible for this functionality.

@xanderdunn

@ZyX-I Thanks. :h guicolors turns up nothing on latest stable (7.4.488), but I was hoping to discover if it had made it in without building latest vim source.

@ZyX-I
Contributor
ZyX-I commented Dec 30, 2014

@alexdunn Presense of the options is checked using echo exists('&guicolors') (echo exists('+guicolors') to check whether it exists and was enabled at compile time). Help topic for options is :h 'guicolors', not without single “quotes” (:h accepts partial matches, so usually this works, but may lead you to the wrong tag unlike when using full match).

@xanderdunn

@ZyX-I Thanks for these details.

Running ./configure --enable-termtruecolor on latest source from https://vim.googlecode.com/hg/, ends with this:

configure: WARNING: unrecognized options: --enable-termtruecolor

So I think that makes it clear this hasn't gotten into mainstream vim yet.

@ryneeverett

@ZyX-I Do you know of any reason set spell would have no visible effect with set guicolors?

@ZyX-I
Contributor
ZyX-I commented Feb 23, 2015

@ryneeverett By default SpellBad highlight group sets colors for terminal (they are ignored because gui colors are used), undercurl gui attribute (ignored because cterm attributes are used, not gui attributes) and guisp color for gui (ignored because terminal does not have corresponding capability).

So default highlight group sets only properties that are ignored for one or the other reason.

@ZyX-I
Contributor
ZyX-I commented Feb 23, 2015

By the way, this is unrelated issue that is long since closed.

@ZyX-I ZyX-I locked and limited conversation to collaborators Feb 23, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.