Colour is specified separately for each primitive type by a colour index value.
To set entries in the colour look-up table one must call the function Set Colour Representation (GSCR). It takes as parameters the workstation identifier, the colour index to be set, and a value (from 0 to 1.0) for each of the red, blue, and green intensities. The workstation then uses the closest available colour to that which has been requested.
CALL GSCR(WKID, INDEX, RED, GREEN, BLUE)
The highest possible value for the colour index (NCOLI) depends on the capabilities of the device and can be inquired using GQCF and specifying the workstation type:
CALL GQCF(WTYPE, ERRIND, NCOLI, COLA, NPCI)The parameter COLA ('GMONOC' or 'GCOLOR') indicates whether or not colour is available, and NPCI specifies the number of pre-defined colour indices.
The colour index can also be used if part of a previously drawn picture is to be erased. The part to be erased should be re-drawn in the background colour (index=0). All other attribute settings and transformations must be exactly as they where when the picture was produced initially. However, even in this case, the trick may not work if the primitive being erased overlays another primitive, and not just the background.
Colour may be part of a fill area pattern, in which case different parts
of the pattern may be defined to be different colours.
For the cell array primitive an array of colours is specified
as part of the primitive itself.