Reserving Colors

If you use a PseudoColor display device, when IDL starts, it attempts to secure entries in the shared system color map for use when drawing graphics. In versions of IDL prior to version 7.0, the value of the Idl.colors X resource was used, either to specify the number of colors to be allocated to the shared colormap or to populate the value of the IDL_GR_X_COLORS system preference.

In IDL 7.0 and later, IDL simply uses the value of the IDL_GR_X_COLORS system preference. If for some reason IDL cannot allocate the requested number of colors from the shared colormap, it will create a private colormap. Using a private colormap ensures that IDL has the number of colormap entries necessary, but can lead to colormap flashing when the cursor or window focus moves between IDL and other applications.

One way to avoid creating a private colormap for IDL is to set the IDL_GR_X_COLORS preference equal to a negative number. This causes IDL to try to use the shared colormap, allocating all but the specified number of colors. For example, setting the preference value to -10 instructs IDL to allocate all but 10 of the currently available colors for its use. Thus, if there are a total of 220 colors not yet reserved by other applications (such as the windowing system), IDL will allocate 210 colors from the shared colormap.

Note
If you use a TrueColor display device, IDL does not rely on the system's shared color map when drawing graphics. There is no need to either reserve colors from the shared color map or create a private color map.