How IDL Interprets Color Values

IDL determines colors to display differently based on whether the destination object uses an Indexed or RGB color model, and on whether the physical destination device supports an Indexed or RGB color model.

Indexed Color Model

If the destination object uses an Indexed color model, the color displayed is calculated from the value specified by the object’s COLOR property as follows:

If a Color Index is Specified

If an RGB Triple is Specified

RGB Color Model

If the destination object uses an RGB color model, the color displayed is calculated from the value specified by the object’s COLOR property as follows:

If a Color Index is Specified

If the graphic object for which the color is being determined has a palette associated with it, the RGB triple at that palette’s color index is retrieved. Otherwise, the RGB triple at the specified index in the destination object’s palette is retrieved.

If an RGB Triple is Specified

If the RGB color model is used, the palette associated with a destination object does not necessarily have a one-to-one mapping to the hardware color lookup table for the device. For instance, the destination object may have a grayscale ramp loaded as a palette, but the hardware color lookup table for the device may be loaded with an even sampling of colors from the RGB color cube. When a user requests that a graphical object be rendered in a particular color, that object will appear in the nearest approximation to that color that the device can supply.