Color

Tim Robishaw has written a fantastic routine for making colors behave in idl. Put this line in your start.idl file (or equivalent startup file):

setcolors, /silent,/SYSTEM_VARIABLES

and then use color names (!red, !magneta, !white) to make the colors you want, like this:

plot,indgen(10),/nodata
oplot,indgen(10), color=!blue

Call

setcolors, /test

to see if it's working (if it doesn't work right away, try it again — you may need to have a plotting window going before it works).

setcolors.pro

If you just want to be able to get the color you want without subscribing to the whole system variable thing, try this routine:

getcolor.pro

More color magic (computes a 24-bit color values from separated-out R, G, and Bs):

color24.pro

A different approach

See Marshall's notes on color for a different approach to making colors work, following the advice of the illustrious David Fanning.