Next: , Previous: , Up: Graphics   [Contents][Index]


8.2 Colors

In the X window display system used by LUX, a finite number of different colors can be displayed at any one time. Depending on your computer system and the default settings for your window manager, you may be using any one of the six display methods ("visual classes") offered by X. Most users probably have an 8-bit PseudoColor display by default, which can show 256 distinct colors at any given time, and the characteristics of this display method are explained below.

The colors available for display at a given time can be thought of as occupying a finite number of color cells with one color to a cell, forming a color map. The finite number (usually 256) of color cells available in the default color map must be shared between all X window applications (such as LUX) running at the time.

The human eye can distinguish about one hundred to two hundred shades of gray, so if LUX has much fewer than 100 color cells available to it, then images that it displayed would look noticeably artificial. To prevent the most egregious of such cases, LUX sets a lower limit of 64 color cells for image display. LUX also needs some color cells for incidental colors, such as window background colors, widget button colors, and line drawing colors. Also, it is polite not to grab all remaining color cells, or else other programs that are started after LUX may complain or fail. If not enough color cells remain, then LUX requests a private color map.

If the user explicitly requests a private color map through XOPEN,/PRIVATE_COLORMAP, or if less than 96 color cells remain available in the default color map, then LUX goes for a private color map, and otherwise for the default color map. In either case, LUX grabs all but a few of the remaining color cells for use in displaying images. The grabbed color cells are referred to as the color ramp, because they are initialized with a linear greyscale ramp. The number of color cells that are left for incidental colors and for other applications is equal to one third of the number of color cells in the color ramp, with a minimum of 2 and a maximum of 32. Incidental colors are allocated from the remaining cells only when the need arises. If LUX requests a new incidental color but no more color cells are available, then it issues a warning and substitutes an already allocated color instead.

Generally, there is a limit to the number of color maps that can be active at the same time on a given screen. If too many color maps are being used by all of the current applications, then only some of them will show up correctly (including the one that the pointer – graphical cursor – is in). For example, if you run LUX on a system where only a single color map can be active at any given time, and if LUX is using a private color map, then the terminal window (in which you type LUX commands) and LUX windows and widgets cannot all be shown with the correct colors at the same time. If you move the pointer into a LUX window, then all LUX windows will be shown with the correct colors, and if you move the pointer outside of all LUX windows, then the terminal window and screen background will be shown with the correct colors.

See also: xopen


Next: , Previous: , Up: Graphics   [Contents][Index]