;+ ; NAME: rainbow ; PURPOSE: ; Return a vector of color indices, from fsc_color. ; NOTES: ; requires Dave Fanning's FSC_COLOR.pro ; ; Note that for output to file you need to call this AFTER you call ; psopen. ; ; INPUTS: ; KEYWORDS: ; n=n how many colors do you want? this will repeat the rainbow enough ; times that you have at least n colors. ; /more Return more colors (16 elements to the rainbow, versus ; the default 10) ; /pale return a pastel rainbow instead of the usual vibrant colors. ; /dim make any of the above color tables half as bright ; /light inverse of dim: make any of the above twice as bright. ; OUTPUTS: ; a vector of color indices ; ; HISTORY: ; Began 2005-04-20 14:50:34 by Marshall Perrin ;- FUNCTION rainbow,n,more=more,number=number,pale=pale,redblue=redblue,$ greenyellow=greenyellow, dim=dim, light=light if keyword_set(n) then number=n if keyword_set(redblue) then begin ; a set of colors sliding from red to blue if ~(keyword_set(number)) then number = 20 r = lindgen(number)*255/(number-1) b = reverse(r) colors = 256l^2*r+b return,colors endif if keyword_set(greenyellow) then begin ; a set of colors sliding from red to blue if ~(keyword_set(number)) then number = 20 r = lindgen(number)*255/(number-1) b = reverse(r) colors = 256l^2*r+b+256l*235 return,colors endif ; yellow on white is illegible, so avoid it. but on ; the screen it's ok. For postscript, use a dark-ish ; yellow instead if !d.name eq "PS" then yellow="Peru" else yellow="Yellow" ; similarly, don't output white on postscript, use black instead if !d.name eq "PS" then white="gray" else white="white" retval= [ fsc_color('red'), $ fsc_color('orange'), $ fsc_color(yellow), $ fsc_color('green'), $ fsc_color('forest green'), $ fsc_color('cyan'),$ $ fsc_color('blue'), $ fsc_color('purple'), $ fsc_color('magenta'), $ fsc_color('gray'),$ fsc_color(white)] if keyword_set(more) then $ retval = [ $ fsc_color('Red'), $ fsc_color('Orange Red'), $ fsc_color('Orange'), $ fsc_color(yellow), $ fsc_color('Green Yellow'), $ fsc_color('Green'), $ fsc_color('Dark Green'), $ fsc_color('Forest Green'), $ fsc_color('Cyan'), $ fsc_color('Blue'), $ fsc_color('Dodger Blue'), $ fsc_color('Purple'), $ fsc_color('Magenta'), $ fsc_color('Deep Pink'), $ fsc_color('Gray'), $ fsc_color(white) $ ] if keyword_set(pale) then retval = $ [ fsc_color('Pink'),$ fsc_color('Khaki'),$ fsc_color('Papaya'),$ fsc_color('Light Cyan'),$ fsc_color('Powder Blue'),$ fsc_color('Honeydew'),$ fsc_color('Lavender'),$ fsc_color('Thistle')] ; return, [ getcolor('red'), getcolor('orange'), getcolor('yellow'), getcolor('green'), getcolor('forest'), getcolor('cyan'),$ ; getcolor('blue'), getcolor('purple'), getcolor('magenta'), getcolor('gray'), getcolor('white')] if (keyword_set(number)) then begin rep = ceil(number*1.0/n_elements(retval)) retval2 = retval for i=0L,rep do retval2 = [retval2,retval] return,retval2 endif if keyword_set(dim) then begin dim *=2 ; default dim is 2, but you can make it more if you want. ; split into RGB B = retval mod 256l; G = (retval/256l) mod 256l R = (retval/(256l^2)) retval= (r/dim)*256l^2+(g/dim)*256l+b/dim end if keyword_set(light) then begin light *=2 ; default light is 2, but you can make it more if you want. ; split into RGB, invert, divide, invert B = 255-(255-retval mod 256l)/light G = 255-(255-(retval/256l) mod 256l)/light R = 255-(255-(retval/(256l^2)))/light retval= r*256l^2+g*256l+b end return,retval end