blank.gif (43 bytes)

Church Of The
Swimming Elephant

Index | Description | Starting Up | Displays | Access Control | Geometry Specification
Window Managers | Fonts | Colors | Keyboards | Options | Resources | Examples | Diagnostics



Most applications provide ways of tailoring (usually through resources or command line arguments) the colors of various elements in the text and graphics they display. A color can be specified either by an abstract color name, or by a numerical color specification. The numerical specification can identify a color in either device-dependent (RGB) or device-independent terms.

Color strings are case- insensitive. X supports the use of abstract color names, for example, "red", "blue". A value for this abstract name is obtained by searching one or more color name databases. Xlib first searches zero or more client-side databases; the number, location, and content of these databases is implementation dependent. If the name is not found, the color is looked up in the X server's database. The text form of this database is commonly stored in the file /usr/lib/X11/rgb.txt.

A numerical color specification consists of a color space name and a set of values in the following syntax:

An RGB Device specification is identified by the prefix "rgb:" and has the following syntax:
rgb:<red>/<green>/<blue> <red>, <green>, <blue> := h | hh | hhh | hhhh h := single hexadecimal digits
Note that h indicates the value scaled in 4 bits, hh the value scaled in 8 bits, hhh the value scaled in 12 bits, and hhhh the value scaled in 16 bits, respectively. These values are passed directly to the X server, and are assumed to be gamma corrected.

The eight primary colors can be represented as:

black rgb:0/0/0
red rgb:ffff/0/0
green rgb:0/ffff/0
blue rgb:0/0/ffff
yellow rgb:ffff/ffff/0
magenta rgb:ffff/0/ffff
cyan rgb:0/ffff/ffff
white rgb:ffff/ffff/ffff

For backward compatibility, an older syntax for RGB Device is supported, but its continued use is not encouraged. The syntax is an initial sharp sign character followed by a numeric specification, in one of the following formats: #RGB (4 bits each) #RRGGBB (8 bits each) #RRRGGGBBB (12 bits each) #RRRRGGGGBBBB (16 bits each) The R, G, and B represent single hexadecimal digits. When fewer than 16 bits each are specified, they represent the most-significant bits of the value (unlike the "rgb:" syntax, in which values are scaled). For example, #3a7 is the same as #3000a0007000. An RGB intensity specification is identified by the prefix "rgbi:" and has the following syntax:

The red, green, and blue are floating point values between 0.0 and 1.0, inclusive. They represent linear intensity values, with 1.0 indicating full intensity, 0.5 half inten- sity, and so on. These values will be gamma corrected by Xlib before being sent to the X server. The input format for these values is an optional sign, a string of numbers possibly containing a decimal point, and an optional exponent field containing an E or e followed by a possibly signed integer string. The standard device-independent string specifications have the following syntax:
CIEXYZ:<X>/<Y>/<Z> (none, 1, none)
CIEuvY:<u>/<v>/<Y> (~.6, ~.6, 1)
CIExyY:<x>/<y>/<Y> (~.75, ~.85, 1)
CIELab:<L>/<a>/<b> (100, none, none)
CIELuv:<L>/<u>/<v> (100, none, none)
TekHVC:<H>/<V>/<C> (360, 100, 100)
All of the values (C, H, V, X, Y, Z, a, b, u, v, y, x) are floating point values. Some of the values are constrained to be between zero and some upper bound; the upper bounds are given in parentheses above. The syntax for these values is an optional '+' or '-' sign, a string of digits possibly containing a decimal point, and an optional exponent field consisting of an 'E' or 'e' followed by an optional '+' or '-' followed by a string of digits.

For more information on device independent color, see the Xlib reference manual.


Protect yourself from cyberstalkers, identity thieves, and those who would snoop on you.
Stop spam from invading your inbox without losing the mail you want. We give you more control over your e-mail than any other service.
Block popups, ads, and malicious scripts while you surf the net through our anonymous proxies.
Participate in Usenet, host your web files, easily send anonymous messages, and more, much more.
All private, all encrypted, all secure, all in an easy to use service, and all for only $5.95 a month!

Service Details

Have you gone to church today?
All pages ©1999, 2000, 2001, 2002, 2003 Church of the Swimming Elephant unless otherwise stated
Church of the Swimming Elephant©1999, 2000, 2001, 2002, 2003 is a wholly owned subsidiary of Packetderm, LLC.

Packetderm, LLC
210 Park Ave #308
Worcester, MA 01609