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:

oplot,indgen(10), color=!blue


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).

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

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

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.