Internal: Explaining the Color Scheme Used by IDL (UNIX 8-bit pseudocolor display)
Anonym
Topic:
Explaining the Color Scheme Used by IDL when running in PseudoColor.
Discussion:
How IDL decides how many colors to use:
When IDL establishes a connection with an X-display, it checks to see how many colors are available. This number varies depending on how many other applications are using color and how many colors the actual X-server has in use. These colors all typically come from one colormap called a shared color map. For example, since there are 256 colors on any 8-bit display, the colors might be as follows:
X-Server 14 colors used
X-Clock 4 colors used
Display Postscript 100 colors used
total 118
So in this example, there are 256 - 118 or 138 colors available. If you were to start up IDL, typically IDL will use all 118 colors that remain. Programs should never rely on a fixed number of colors. Instead, they should scale everything based on the !D.N_COLORS variable which tells how many colors IDL actually is using.
Using a set number of colors possibly larger than the number available:
In some cases, you may require a larger number of colors than are available currently on the X-server. To do this, you need to issue the command:
Where n is the number of colors you would like to use. If n is greater than the number available, a private colormap is created for use by IDL. This means that whenever and IDL window is made the current window, its color table takes charge and is used by all applications. This can have the side effect of obliterating all the other windows temporarily when it toggles colormaps to optimize for the IDL window. You can never use more than 256 colors on an 8-bit display, even if you are using private colormaps.
Using Multiple sessions of IDL:
At times you may want to have separate IDL sessions running that use different color tables. To do this, you need to pick a number of colors for each IDL session that is small enough that the total number of colors for all IDL sessions and other applications is less than or equal to 256. This allows each IDL to have its own colors but doesn't cause the colormap to toggle between color maps when you select different windows.Solution:
[Edit this field in the IDL-based Tech Tip Editor, v3]