Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what's the meaning of color[0-15] in urxvt settings?

Tags:

terminal

vim

First, I've searched the topics on google.com, but not help a lot.

I've configured my urxvt using some color themes, but it's really hurt my eyes. So, I decided to create my own using some Vim color pallete. I really need to know what's the meaning of color0 - color15 in urxvt .Xdefaults or .Xresources setting. What's the purpose of those colors? Anyone knows?

like image 309
Pattisahusiwa Avatar asked Apr 04 '15 14:04

Pattisahusiwa


2 Answers

The purpose of those colors is to be colors.

Terminal emulators usually let you define the 16 "ASCII" colors:

Normal      Bright
--------    -------
0 Black      8 Black
1 Red        9 Red
2 Yellow    10 Yellow
3 Green     11 Green
4 Blue      12 Blue
5 Magenta   13 Magenta
6 Cyan      14 Cyan
7 White     15 White

Where the "Normal" colors are usually darker and the "Bright" ones lighter.

like image 127
romainl Avatar answered Oct 04 '22 21:10

romainl


As noted, there is no such thing as "ASCII" colors, no matter how many. "ANSI" colors also is problematic, since ANSI (referring to the defunct x3.64 standard) never specified 16 colors.

urxvt's color0-color15 resource names are inherited from rxvt's simulation of X resource settings. (X resources are usually managed by X Toolkit, which neither uses). urxvt's manual page considers these too well known to mention any details. rxvt would search for resource settings using both "XTerm" and "Rxvt" classnames, and in so doing incorporated several resource names from xterm. urxvt (which started as a translation of rxvt into C++) dropped that (searching for "XTerm") feature in 2004, but kept most of the other rxvt resource names.

Those names were defined in xterm (see manual), for these two ranges:

  • color0-color7 -- These specify the colors for the ISO-6429 extension. The defaults are, respectively, black, red3, green3, yellow3, a customizable dark blue, magenta3, cyan3, and gray90. The default shades of color are chosen to allow the colors 8-15 to be used as brighter versions.
  • color8-color15 -- These specify the colors for the ISO-6429 extension if the bold attribute is also enabled. The default resource values are respectively, gray30, red, green, yellow, a customizable light blue, magenta, cyan, and white.

The second range is a different type of "extension": ISO-6429 does not define escape sequences which might correspond to those. Rather, xterm combines two features into one palette:

  • SGR 90-107 (aixterm's extended control sequences for 16-colors, incorporated in xterm in 1997).
  • "PC-colors" (an alternative to treat bold as bright colors to work around font problems -- also from 1997).
like image 41
Thomas Dickey Avatar answered Oct 04 '22 21:10

Thomas Dickey