How do I get colors using X?

There is a list of colors in /usr/lib/X11/rgb.txt. Each line has the Red, Green, and Blue values of the color, followed by a name that can be used to specify that RGB value. You can also specify RGB Values directly.

For example, here is a section of a .Xresources file:


#ifdef COLOR

xlogout*background:               SkyBlue

xbiff*foreground:                 green4
xbiff*background:                 Rgb:0/0/18

xclock*foreground:                green4
xclock*hands:                     green4
xclock*highlights:                green4
xclock*background:                Rgb:0/0/18

netscape*background:                      SlateGray3

netscape*anchorColor:                     Green4

netscape*visitedAnchorColor:              blue4

*background:                      AntiqueWhite

#else

XLock*foreground:                 grey90
XLock*background:                 grey20

XMeter*errorFore:                 black
XMeter*errorBack:                 white
XMeter*errorH1:                   gray50

XMeter*warnFore:                  white
XMeter*warnBack:                  black
XMeter*warnH1:                    gray50

XMeter*okFore:                    grey60
XMeter*okBack:                    black
XMeter*okH1:                      grey30

netscape*background:                      Grey20
netscape*anchorColor:                     black

netscape*visitedAnchorColor:              black

#endif

Colors may be specified in the ".twmrc" and ".Xdefaults" files in your home directory. The examples given are from ~samples/.

You may also use the options -bg and -fg to set the background and foreground colors of your windows. See "man xterm" for details. These options work for most X clients.

See "man X" for a description of how to specify colors.

© Computing and Educational Technology Services