.BG
.VE $Header: /usr3/s/current/s/.help/RCS/color,v 1.2 83/12/30 19:25:56 rab Exp $
.FN color
.TL
color: Modify AED512 Color Table
.CS
color(table, interact)
.PP
.AG table
optional matrix with 4 columns,
in which each row specifies a color number
and its associated hue, lightness, and saturation.
Colors not defined by `table' are left unchanged.
If `table' is missing and `interact' is TRUE, then no default
colors are set up.
Otherwise,
color 0 (the background) is
dark blue and colors 1 through
8 are cyan, green, yellow, blue, magenta, red, white, and
black.
In addition colors 20 through 35 form
a gray scale from black to white and colors 50 through 89
form a spectrum of fully saturated colors beginning and
ending with blue.
.AG interact
optional logical flag indicating whether to invoke
the interactive mode in which the AED512 color
table may be dynamically modified.
Default is FALSE.
.RT
the input table 
modified (and perhaps expanded) by
the results of any interaction.
.SH COMMENTS
During interaction there is always a `current color'
(specified by its number in the color table)
and a `current mix'
(a new color potentially "under construction").
These are both displayed in the upper right corner of
the screen.
Initially the current color is 1 
and the current mix has the same formula as 1.
.PP
The relabelled numeric key pad on the terminal is used repeatedly
to initiate one of eleven functions during interaction.
A brief description (usually one word) of the currently
selected function always
appears at the top left of the screen.
The two chief activities during interaction are
"picking a number" and "mixing a color", each of
which may be accomplished in one of three ways.
.PP
To pick a new current color the user may hit "number",
in which case the terminal prompts for a number.
This should be an integer in the range 0 to 127
followed by a carriage return.
Pushing "picture" will cause a cursor to be displayed
which can be moved around using the joystick.
When "quit" is depressed the color at the current cursor
position becomes the current color.
Finally, "palette" causes a display of the current
color table to appear with a large cursor overlaid.
Each square of the table is filled in a different color,
numbered consecutively beginning at 0 in the upper left
and proceeding across the rows.
The rows are ten squares wide so that, for example, the
first column contains color numbers 0,10,20,...,120.
Again, "quit" causes the color at the current
cursor position to become the current color.
.PP
In order to mix a new color the user may hit "circle",
in which case a color circle is displayed with 
several colors on the perimeter,
and with the interior filled with the current mix.
(See the documentation for `ctable' for a description of
this circle and of the hue-lightness-saturation model.)
Again a cursor is displayed and its position around the circle
represents the hue of the current mix while its distance
from the center of the circle represents saturation (the
perimeter being full saturation).
"show color" will cause these two qualities
to be determined from the cursor position and the current
mix will be appropriately updated.
The third quality of the mix--its lightness--is
read from the vertical position of the cursor when
"lightness" is depressed
(the bottom of the screen corresponds to black and the
top to white.)
Two small white squares may appear in this display and
represent the definition of the current color,
when it is known.
The square inside the circle defines the hue and saturation 
of the current color while the square at the right of the
screen defines the lightness of the current color.
As usual, "quit" will cause the cursor (and, in this case,
the circle) to disappear.
.PP
A second method of mixing a new color is to use "virtual".
In this case "show color" and "lightness" work exactly as
before with respect to the displayed cursor, but the color
circle no longer appears--it is only "virtually" present.
In this mode any portions of the screen colored in the
current color will temporarily be modified to be
colored in the current mix, and will assume their original
color when "quit" is hit (provided the current color is "known".)
Finally, a color may be mixed by using "same as".
The user then selects a color number according to one of the
three methods described above and the current
mix becomes the same as the color corresponding to that number.
.PP
If at any time "save" is depressed, the current
color becomes defined by the current mix.
Pushing "specify" 
allows entry of a specification string (see function `ctable') from the keyboard.
.PP
During interaction, the user may determine what is expected
by examining the ending of
the description at the top left of the screen:
.PP
      '?'    hit a function key
.PP
      ':'    type in a line followed by carriage return
.PP
      null   position cursor and hit a function key
.PP
      '...'  program is talking to AED: do NOTHING!
.PP
During cursor positioning there is a one function read-ahead
in effect so that striking a function other than "quit" has
the same effect as hitting "quit" followed by that function.
.PP
`Color' only "knows" the colors defined in `table' or
created during interaction.
Only "known" colors are returned by the function or
restored after using "virtual".
.SH REFERENCE
R. A. Becker and A. R. Wilks,
"Raster Color Graphics: Principles and an Implementation",
AT&T Bell Laboratories Memorandum.
.EX
color( )  # set up default table with no interaction
mytable <- color(ctable(oldtable),interact=T)
      # set up oldtable, interact, and save result
.KW color
.KW device*
.KW plot*
.WR
