1. Home
  2. COLOUR directive

COLOUR directive

Defines the red, green and blue intensities to be used for the Genstat colours for certain graphics devices.


RESET = string token Whether to reset values to their defaults (yes, no); default no


NUMBER = scalars Numbers of the colours to be set
RED = scalars Red intensity of each colour (between 0 and 255)
GREEN = scalars Green intensity of each colour (between 0 and 255)
BLUE = scalars Blue intensity of each colour (between 0 and 255)
MATCH = scalars Number of a Genstat colour to define any unset values of RED, GREEN or BLUE; default is to restore the original values of the colour
SAVE = pointers Pointers each containing three scalars to save the red, green and blue intensities of the colours


The COLOUR directive allows you to redefine the standard Genstat colours. In Releases prior to Release 11 these standard colours were used in directives like PEN to define the colours of the various components of the graph. In Release 11, however, colours in these directives are defined by default by setting them explicitly to an RGB value (see PEN). However, you can arrange to use the old method by specifying the statement

SET [CMETHOD=standard]

Genstat uses the RGB colour system to define each standard colour (numbered from 0 to 256) in terms of its red, green and blue components. These are specified as integer values in the range [0,255]. Thus black is represented by (0,0,0), white by (255,255,255), red by (255,0,0), and so on. For compatibility with earlier releases, fractional values between 0 and 1 will be multiplied by 255. The COLOUR directive can be used in three ways. Firstly you can define a colour in RGB terms. For example, you could put

COLOUR 1; RED=255; BLUE=0; GREEN=255

to define colour 1 as yellow. Points plotted in colour 1 would then appear as yellow. Alternatively, the MATCH parameter allows a colour to take its RGB values from the current settings of another colour. For example,


will set colour 2 also to be yellow. Note that if colour 1 is changed again, colour 2 will not be altered. Finally a colour can be returned to its initial default settings by specifying only the colour number. For example,


will set colours 1 and 2 back to their original values. The background colour may be altered by changing the definition of colour 0.

The exact effects of the COLOUR directive will vary for different graphics devices. For monochrome devices, the colour (0,0,0) is taken as the background colour, and any other combination is taken as the foreground colour.

By default any parameters that are not mentioned explicitly in the statement are left unchanged, but you can specify option RESET=yes to reset them back to their initial default settings.

Option: RESET.


See also

Directive: PEN.

Procedure: GETRGB.

Commands for: Graphics.

Updated on June 20, 2019

Was this article helpful?