      subroutine char_color (i)
c
c Set the text color.
c
c The colors are:
c 		1	black
c		2	red
c		3	yellow
c		4	green
c		5	cyan
c		6	blue
c		7	magenta
c		8	white
c 
c James Blake
c @(#)char_color.f	1.1  4/3/89 
c
      include 'device_type.h'
      common/local_color/gray_level 
c
      if (color_ws .or. mono_ws) then
         npen = i - 1
         if (color_ws) then
              if( npen .lt. 0 .or. npen .gt. 7 ) npen = 0
         else
              if (npen.eq.7) then
                   npen = 0
              else
                   npen = 1
              endif
         endif
         call cftextcolor (npen)
      elseif (PostScript) then
c
c Simulate the range of colors used by the SunCGI library.
c
c Black = 0
c White = 1
c
         npen = i
         if (npen .lt. 1) npen = 1
         gray_level = (npen - 1.0) / 7.0
       endif
      return
      end
