You are not logged in.

#1 2016-06-09 09:33:46

easysid
Member
From: India
Registered: 2013-01-01
Posts: 256

[SOLVED] A question regarding true colors and urxvt

The guicolors option in vim requires a terminal supporting 24 bit true colors, which urxvt doesn't. I am given to understand that urxvt is 256 color terminal, and therefore only displays a close approximation of a vim colorscheme. However, we can change the terminal colors, using Xresources, and then the colors are perfect.

I am not sure how urxvt can display those 16 defined colors accurately (or does it), but not other colors, like in vim colorschemes, for example.

Thanks.

Last edited by easysid (2016-06-10 07:22:52)

Offline

#2 2016-06-09 14:11:17

Vain
Member
Registered: 2008-10-19
Posts: 179
Website

Re: [SOLVED] A question regarding true colors and urxvt

Well, urxvt itself can show any color that your X11 server can show (which, today, is usually any RGB color). The question is: How does Vim tell urxvt which color to use? How do they communicate?

Are you familiar with ANSI escape sequences? If not, that's where I'd start. In short: Vim tells urxvt to use a color index, for example "color 4" or "color 232". Vim does not tell urxvt to show "color #223344". This is done using said escape sequences. urxvt then decides, "aha, color 4, that's #0000A0 (dark blue)", and uses this color to render a character.

The GUI version of Vim, on the other hand, can indeed use any RGB color, because there is no terminal involved. gvim might look like a terminal, but it's a full-blown X11 client. If you have a look at Vim colorschemes, you'll notice that GUI themes often use RGB colors directly, e.g. "guifg=#334455". Vim colorschemes for the terminal, however, can only make use of color indices, so you'll see stuff like "ctermfg=63".

Does this answer your question?

Offline

#3 2016-06-09 17:53:34

easysid
Member
From: India
Registered: 2013-01-01
Posts: 256

Re: [SOLVED] A question regarding true colors and urxvt

So there isn't a standard 256 color palette, which is same for all terminal emulators?

Offline

#4 2016-06-09 18:18:22

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,523
Website

Re: [SOLVED] A question regarding true colors and urxvt

No.  There is a defacto standard of the 6x6x6 color cube, but I don't believe there is a strict definition of exactly what the colors are, but rather just that they follow gradient-combinations along red green and blue axes.  This plus the 16 base colors and 24 levels of grayscale make up your 256 colors.

Every terminal emulator has defaults that represent these same color axes/gradients, but they may have different precise color values.  Further, any of these defaults can be overridden.  With most terminal emulators you can specify exactly how each of the 256 colors should be rendered.  For example, in st, you can provide a 24bit hex code for each one (at compile time).


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#5 2016-06-09 18:20:05

Vain
Member
Registered: 2008-10-19
Posts: 179
Website

Re: [SOLVED] A question regarding true colors and urxvt

Oh, yes, there is. A lot of terminal emulators (or maybe even all of them) use the 256 colors as introduced by XTerm:

https://upload.wikimedia.org/wikipedia/ … _chart.svg

The first 16 colors, which you can find at the bottom of that image, are usually those customized by many people.

(Your question tells me that I haven't really grasped your initial question, though.)

– edit: Yeah, okay. Trilby might be right. I don't think there's a strict standard for those colors.

Last edited by Vain (2016-06-09 18:23:21)

Offline

#6 2016-06-10 07:22:27

easysid
Member
From: India
Registered: 2013-01-01
Posts: 256

Re: [SOLVED] A question regarding true colors and urxvt

Oh, OK. I get it now. Trilby's answer made it quite clear. Thanks for the help everyone. smile

Offline

Board footer

Powered by FluxBB