Skip to content

X Window System Color Support

Color handling in the X Window System is complex because of the need for portability to many different types of displays. The X Window System supports color using colormaps and a color name database. It is not necessary to read the information in this topic to configure Reflection X: it is here for those users who desire a better understanding of X Window System color support.

Colormaps

Colors that you see on your monitor are defined by a combination of the intensities of red, green, and blue. This is called the RGB color model, and is the most commonly used model for color displays. RGB color definitions are stored in the elements (called colorcells) of lookup tables (called colormaps), which are stored on the server. All X servers create a default colormap that is available to (and shared by) clients that require a small number of colors. Clients that are more color-intensive may create their own private colormaps.

When client applications attempt to use color, they do not specify a pixel value, or the color to put in that cell to draw in a given color. Instead, they request access to a colorcell in a colormap, and are returned a pixel value.

The range of colors available on the screen is a function of the number of bit planes (the pixel depth, which determines the number of colors that can be displayed) and the width of the hardware color registers (if eight bits are available for each primary, then the range of colors is about 16 million).

The X Window System supports virtual colormaps so that any number of colormaps can be maintained, even though the number that may be in use at a time may be limited. Virtual colormaps are swapped in and out of hardware colormap "slots" by the window manager.

Visual

A visual describes the display format for a particular screen. It contains information about one way to use the capabilities of the display hardware. There may be several applicable visuals.

The six visual classes distinguish between color or monochrome, whether the colormap is read/write or read-only, and whether a pixel value provides a single index to the colormap or is composed of separate indices for red, green, and blue values. A comparison of the visual types follows:

Visual Type Read/Write Read-Only
Monochrome/Gray GrayScale StaticGray
Single index for RGB PseudoColor StaticColor
Separate indices for RGB Direct Color TrueColor

A screen that supports the DirectColor class can theoretically support any of the six visual classes. Screens that support the PseudoColor visual class can also support GrayScale, StaticColor, or StaticGray visual classes. If the screen supports the GrayScale visual class, it can also support StaticGray.

Even though a certain visual class can theoretically be supported by the capabilities of a display hardware system, the server implementation determines whether that visual class is supported.

More information

Back to top