6

I've found an endless supply of themes availble online that use hex-color codes to change how X windows display, but I can't find any documentation that clearly states what each color does. For instance, in my .Xresources file:

*color0:     #000000
*color1:     #e59400
*color2:     #00cc00
*color3:     #00cc00
*color4:     #005500
*color5:     #e59400
*color6:     #00cc00
*color7:     #00cc00
*color8:     #000000
*color9:     #e59400
*color10:    #e59400
*color11:    #e59400
*color12:    #005500
*color13:    #e59400
*color14:    #e59400
*color15:    #00cc00

I know how to change each 'color' but I don't know what each one is actually changing, in other words...which color goes to what?

1 Answer 1

6

Those are used in xterm. They define a color palette. Colors 0-7 are the eight "ANSI" colors. For colors 8-15, it is more complicated:

  • xterm can be told to display text which is bold, using colors (the boldColors resource—see manual). It does this as an alternative to using bold fonts because some bitmap fonts are available as bold only by overstriking the font offset by one pixel -- not always readable (this is configurable using the boldFont resource).
  • xterm also uses the same colors for implementing the aixterm 16-color control sequence (which is unrelated to the bold video attribute).

The manual also lists the default values for the colors as names. X maps the names to RGB values. Those hex-color codes are one way of representing RGB (red/green/blue) using two hexadecimal digits for each color. You may also see that represented in the format rbg:rr/gg/bb.

Some programs assume that color0 is the same as the background color and color7 is the same as the foreground (text) color. Actually, xterm maintains those colors with a separate set of default values (the -fg and -bg command-line options for instance).

1
  • I wondered if that was the case but didn't have the data to be 100% sure. Thanks! Jun 7, 2015 at 20:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .