;+ ; ; @file_comments ; Fastest than type loadct, file = 'palette.tbl' ; ; @categories ; Graphics, Color ; ; @param numpal {in}{optional} ; number of the color palette we want to select in the file palette.tbl ; ; @keyword LIGHTNESS ; a scalar used to change the Lightness of the color ; palette to be able to adjust according to the printer we use, ; the media (paper or slide)... ; lightness < 1 to get lighter colors ; > 1 to get darker colors ; ; @keyword FILE {default='palette.tbl'} ; The file containing the color palette. It can be in any directory of the !path ; ; @keyword GET_NAME ; Set this keyword to a named variable in which the names of the color tables ; are returned as a string array. No changes are made to the color table. ; ; @keyword _EXTRA ; Used to pass keywords to LOADCT ; ; @history ; Sebastien Masson (smasson\@lodyc.jussieu.fr) ; 30/3/1999: add extra ; 6/7/1999: mac/windows compatibility ; ; @version ; $Id$ ; ;- ; PRO lct, numpal, FILE = file, GET_NAME = get_name, LIGHTNESS = Lightness, _EXTRA = ex ; compile_opt idl2, strictarrsubs ; ; definition of the name of the file containing colors palettes. if keyword_set(file) then nametbl = file ELSE nametbl = 'palette.tbl' ; look for nametbl file nametbl = (find(nametbl, /firstfound, /nopro))[0] if nametbl NE 'NOT FOUND' then BEGIN if n_elements(ex) NE 0 then $ if (where(tag_names(ex) EQ 'FILE'))[0] NE -1 then ex.FILE = nametbl ; if we are in POSTSCRIPT mode, we have to pass in X mode in order to change the color palette oldname = !d.name if !d.name EQ 'PS' OR !d.name EQ 'Z' then BEGIN thisOS = !VERSION.OS_FAMILY thisOS = STRMID(thisOS, 0, 3) thisOS = STRUPCASE(thisOS) CASE thisOS of 'MAC': SET_PLOT, thisOS 'WIN': SET_PLOT, thisOS ELSE: SET_PLOT, 'X' ENDCASE !p.BACKGROUND = (!d.n_colors-1) < 255 !p.color = 0 if !d.n_colors gt 256 then !p.background = 'ffffff'x ENDIF ; if arg_present(get_name) then begin if n_elements(numpal) EQ 0 then $ loadct, file = nametbl, GET_NAME = get_name, _EXTRA = ex $ ELSE loadct, numpal, file = nametbl, /silent, GET_NAME = get_name, _EXTRA = ex ENDIF ELSE BEGIN if n_elements(numpal) EQ 0 then loadct, file = nametbl, _EXTRA = ex $ ELSE loadct, numpal, file = nametbl, /silent, _EXTRA = ex ENDELSE ; if oldname EQ 'PS' AND keyword_set(lightness) then palit, lightness ; set_plot, oldname IF oldname EQ 'X' OR oldname EQ 'MAC' OR oldname EQ 'WIN' then BEGIN !p.BACKGROUND = (!d.n_colors-1) < 255 !p.color = 0 if !d.n_colors gt 256 then !p.background = 'ffffff'x ENDIF ENDIF ELSE ras = report('The file containing the color palettes doesn''t exist...') return end