;+ ; NAME: ; flip_colors ; PURPOSE: ; Reverse color table and/or fore- and background colors ; CATEGORY: ; Annoying ; CALLING SEQUENCE: PRO flip_colors, $ flip_bw = flip_bw , $ flip_ct = flip_ct , $ silent = silent , $ noflip_bw = noflip_bw , $ noflip_ct = noflip_ct ; INPUTS: ; (none) ; OPTIONAL INPUT PARAMETERS: ; /flip_bw ; /flip_ct ; /silent ; OUTPUTS: ; INCLUDE: @compile_opt.pro ; On error, return to caller ; CALLS: ; InitVar ; PROCEDURE: ; MODIFICATION HISTORY: ; MAR-2009, Paul Hick (UCSD/CASS; pphick@ucsd.edu) ;- InitVar, silent , 0 flip_bw_specified = IsType(flip_bw,/defined) flip_ct_specified = IsType(flip_ct,/defined) InitVar, flip_bw, /key InitVar, flip_ct, /key InitVar, noflip_bw, /key InitVar, noflip_ct, /key ; Most of of color table usage in the vupack routines use dark (bottom of typical ; color table to indicate high values (high velocity,density) and light (top of color ; table) to indicate low values (low velocity,density). ; So we make flip_ct "on" the default, i.e. NOT specifying /flip_ct means that ; we DO flip the color table. YIKES! reverse = 1-flip_ct straight = 1-reverse ; The IDL "stretch" function depends on the common block "colors" filled by a "loadct" ; call. These contain 256-element color table array. So 256 must be used even on ; a true color device with more than 256 colors. IF NOT noflip_ct THEN stretch, 255*reverse, 255*straight IF silent LE -1 THEN $ message, /info, who_am_i(/caller)+', '+ !d.name+': color table '+(['','not '])[straight]+'reversed' reverse = flip_bw_specified *(flip_ct_specified*flip_bw+(1-flip_ct_specified)*(1-flip_bw))+ $ (1-flip_bw_specified)*(flip_ct_specified*flip_bw+(1-flip_ct_specified)*(1-flip_ct)) straight = 1-reverse IF NOT noflip_bw THEN BEGIN !p.color = (reverse*!TheBackgroundColor+straight*!TheForegroundColor)*(!d.n_colors-1) !p.background = (reverse*!TheForegroundColor+straight*!TheBackgroundColor)*(!d.n_colors-1) ENDIF IF silent LE -1 THEN $ message, /info, who_am_i(/caller)+', '+!d.name+': fore- and background colors '+(['','not '])[straight]+'reversed' RETURN & END