! P_COLOR.GRAPHIC
!	Nice colour lookup table with fixed colour for the zero...
! Author ??  Optimized S.Guilloteau
! @ p_color [fraction]
!  Fraction : percentage of the LUT_SIZE
!          at which saturation gets to 1
!          away from the 0 value.
!  Allows to hide the noise in black (>0)
!  or white (<0) 
!------------------------------------
let lut%saturation 1
def integer izero jmax
if .not.exist(color) then
  define integer color[3] /global
  let color 0 360 25
  symbol color "@ p_color.greg"
endif
define real ocolor
if ("&1 ".ne." ") then
  let color[3] &1
endif
let izero nint(-true_scale[1]|(true_scale[2]-true_scale[1])*(lut%size-1))+1
!
let jmax lut%size-izero
let lut%hue[i] mod(color[1]+(color[2]-color[1])*(i-izero)|jmax,360)
ocolor = color[3]*lut%size/100
if (ocolor.gt.0) then
  let lut%value[i] min(1.,abs(i-izero)|ocolor)
  let lut%saturation 1
else  if (ocolor.lt.0) then
  let lut%value 1
  let lut%saturation[i] min(1.,abs((i-izero)|ocolor))
else
  let lut%value 1
  let lut%saturation 1
endif
let lut%hue lut%hue+10.*sin(lut%hue*pi|60)
gtvl\lut
!
