Changing colors


Although it is possible to use specific color values to establish different colors for the Graphical Environment, you should avoid specifying too many colors this way. Depending on the number of colors you can display on your monitor at the same time, there are limits to the number of resources you should set with color values.

The number of colors you can display on your screen simultaneously depends on the capabilities of your hardware, and, therefore, your X server. Some graphics adapters are capable of displaying only 16 unique colors, while others can display 256 distinct colors. These hardware dependencies determine whether your system has a 16-color or a 256-color X server.

The X server uses a colormap to keep track of its color usage. A ``colormap'', sometimes called a color lookup table, is simply an array of color cells. Each color cell contains the RGB values for a particular color. A 16-color server uses a colormap with 16 color cells, and a 256-color server uses a 256-cell colormap.

When the X server is first started, two colors, black and white, are automatically loaded into the first two cells of the colormap. If you are running the scosession session manager, a color palette daemon allocates the next eight cells and assigns the values of the current color palette to these cells.

If you are using a 16-color X server, you only have six additional color cells in the colormap that you can fill. These cells are allocated to clients on a first-come, first-serve basis. If you run an application whose color resources are defined by palette resource variables, no additional cells are filled. But if an application defines a specific color value, even if that color is part of the current color palette, one of the remaining six color cells is assigned that color. In most cases, other applications can then use this color cell as well.

The six extra color cells are only deallocated when the last application specifying one or all of the cells is terminated. Therefore, it is very easy to use up these last six cells if you specify many unique color resources. When all 16 cells of the colormap are allocated for a 16-color X server, no new color designations can be made until a cell is freed. If you make a color designation that cannot fit in the colormap, you see an error message that indicates there are no free color cells. The X server then tries to assign a color from the colormap that is closest to the color you originally wanted.

Of course, if you have a 256-color server, your colormap is considerably larger and you have more latitude for setting color resources with specific colors.

See also:

The NeTraverse Merge colormap

While most applications are designed to share the colors in a colormap, some applications require their own colormaps. This is the case for NeTraverse Merge.

NeTraverse Merge requires the use of the 16 standard DOS colors. If you are using a 256-color X server, the standard colormap is probably large enough to accommodate the colors you usually use and the 16 colors for DOS. However, if you are using a 16-color X server, unavoidable color conflicts occur when running NeTraverse Merge.

If you run a NeTraverse Merge session so your DOS application fills the entire screen, even on a 16-color X server, you can avoid these color conflicts. The server simply loads the DOS colormap and the DOS program can access any of the colors it needs.

When you want to run a DOS application in a window, however, you must take certain steps to avoid color conflicts. One possible solution to this problem is to use scocolor to switch to the DOS Primary Colors palette before starting a NeTraverse Merge session. This palette provides eight of the primary colors most often used by DOS programs. In most cases, these eight colors result in readable text for all windows. However, there may still be cases where you get unreadable windows.

See also the NeTraverse Merge documentation.

Next topic: Changing colors for the entire system
Previous topic: Relationship between palette resource variables and color buttons

© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003