Assuming you haven't subverted the standard deepsearch startup routines, then it should be possible to use the same software, if properly written, on 24-bit and 8-bit displays. Both displays do, in fact, have a "color table." This color table is used for everything in an 8-bit mode, but only for some things in a 24-bit mode, which leads to vast quantities of confusion. Hopefully, by using the standard things we've set up, you should be able to avoid most of that confusion.
By default, the deepsearch software loads a greyscale color table. If you are on an 8-bit display, 20 entries in that color table are set aside for "highlighting" colors; you may be familiar with these, given the green, blue, red, and pink boxes seen in the various stages of the searchscan software. If you are on a 24-bit display, all colors are available at all times, so there's no need to set anything aside in the color table. Routines like "frame" (which plot an image) use the color table, and will by default be displayed as a greyscale image.
There are several instances when you want to access colors. For example:
Again, if you haven't subverted the deepsearch startup, you can get access to these colors by using the deepsearch routine colordex. You may pass that function the name (or letter) of a color, and it will return to you the number you should use in the examples above.
An example:
IDL> col=colordex('green')
IDL> plot,x,y,color=col
Another example:
IDL> plot,x,y,color=colordex('green')
Yet another example:
IDL> boxdata,30,pho.x,pho.y,colordex('sky blue')
For more information on colordex, use the command
IDL> dlib,'colordex'
There are nineteen colors available by name in the deepsearch IDL software. You may specify them by the name, or by a single letter. The routine colordex doesn't care about upper versus lower case.
Color | Letter |
pinK | K |
Magenta | M |
Red | R |
peacH | H |
Orange | O |
Tan | T |
browN | N |
Yellow | Y |
Forest green | F |
Green | G |
Lime green | L |
turQuoise | Q |
Aquamarine | A |
Sky blue | S |
Blue | B |
Violet | V |
Purple | P |
White | W |
BlaCk (BlaCk) | C |
(Note that some of the colors above may be rendered wrong thanks to limitations of web browsers. Don't worry about it.)
By default, when an IDL session starts on an 8-bit display, it grabs all the available colors and does not share properly with other applications. In order to run IDL harmoniously with other applications, or even with other IDL sessions without flashing, you can add a line to your ~/.Xdefaults (or ~/.Xresources or ~/.rc/Xdefaults or ~/.rc/Xresources, depending on whether you're on a PC or a Sun and how your .xinitrc file is set up) such as the following:
Once IDL grabs whatever number of colors, it saves the setting in a system variable !d and !d.n_colors is set to that number of colors. Whenever the display device is changed between Postscript and X-window, !d is updated accordingly :
Normally, when you create a Postscript file (either by doing "set_plot,'ps'" manually, or using @plotbegin and @plotend), you get greyscale postscript. Images and everything should be fine. However, you won't get the same colors that you get on an X display (even with @plotbegin and @plotend).
If you do want to use color Postscript (meaning bigger but prettier Postscript files), and have the same colors available under Postscript as are available under X, then issue the following commands:
set_plot,'ps'(This will only work as written if you are using the default deepsearch setup.) You only need do this once per IDL session. However, for safety, you will probably want to include these lines in any code using @plotbegin and @plotend. These lines should appear near the beginning, and must appear before the first occurance of @plotbegin.
deepcolor
set_plot,'x'
You should never look at, use, or trust any of these variables. There are two reasons for this. One, they already have different meaning on 8-bit and 24-bit displays, so if you are using them, your code probably won't work on both kinds of displays. Two, in the future we may decide to change how these variables are used internally, meaning that any code which counts on how they are used will break. Use the routines deepcolor and colordex as documented; well-behaved deepsearch programmers who change the meaning of these internal system variables will make sure that those routines still function as they are documented.