subroutine color_comm(line,error)
  use gkernel_interfaces
  use imager_interfaces, only : map_message
  use gbl_message
  !---------------------------------------------------------------------
  !*
  ! IMAGER -- Support for command  
  !   COLOR Span HueMin HueMax [/TYPE Noise|Percent]
  !
  !   calls "@ p_color.ima" to derive a lut
  !   with unsaturated colours up to Span around 0,
  !   and a Hue range between Min and Max 
  !!
  !---------------------------------------------------------------------
  character(len=*), intent(in) :: line  !! Command line
  logical, intent(inout) :: error       !! Error flag
  !
  character(len=8), parameter :: chue  ='HUE     '
  character(len=8), parameter :: cnoise='NOISE   '
  character(len=8) :: key
  real :: colour
  logical :: do_insert
  integer :: n
  !
  if (sic_present(1,0)) then
    call sic_ke(line,1,1,key,n,.true.,error)
    if (error) return
    n = min(n,8)
    if (key(1:n).eq.chue(1:n)) then
      call sic_let_real('COLOR[4]',0.,error)
    else if (key(1:n).eq.cnoise(1:n)) then
      call sic_let_real('COLOR[4]',1.,error)
    else
      call map_message(seve%e,'COLOR','Invalid type '//key(1:n)//'. Choice is '//chue//cnoise)
      error = .true.
      return
    endif
  endif
  call sic_get_real('COLOR[3]',colour,error)
  call sic_r4(line,0,1,colour,.false.,error)
  call sic_let_real('COLOR[3]',colour,error)
  !
  call sic_get_real('COLOR[1]',colour,error)
  call sic_r4(line,0,2,colour,.false.,error)
  call sic_let_real('COLOR[1]',colour,error)
  !
  call sic_get_real('COLOR[2]',colour,error)
  call sic_r4(line,0,3,colour,.false.,error)
  call sic_let_real('COLOR[2]',colour,error)
  !
  do_insert = sic_lire().eq.0
  call exec_program('@ p_color')
  if (do_insert) call sic_insert_log(line)  
end subroutine color_comm
