Previous: , Up: Colors   [Contents][Index]

8.2.2 Incidental Colors

Specific incidental colors can be requested through the setfg (for the foreground color) and setbg (background color) commands and their aliases. The foreground color is used also for line drawings (e.g., plot) and calligraphy (e.g., callig). The color can be identified in two ways: through a color name, or through a set of three numbers.

SETFG,'color-name' sets the foreground color to that specified by the color-name – if that name is recognized. Color names can be either proper names (such as blue or black) or various kinds of color space coordinate "names". In general, colors can be identified by three independent numbers, and there are many different color coordinate systems in use. You specify a color string in a particular recognized color coordinate system by constructing a name that consists of the color coordinate system (case-insensitive) name followed by a colon : followed by the three corresponding coordinates separated by forward slashes /.

The following two color coordinate systems specify colors in a device-dependent manner:


'rgb:<red>/<green>/<blue>' with <red>, <green>, and <blue> three integer numbers consisting of up to four hexadecimal digits (case insensitive). The number FFFF indicates maximum intensity in that color, and 0000 indicates total absence of that color. If fewer than four hexadecimal digits are specified, then hexadecimal zeros are affixed. In other words, the following two specifications are equivalent: 'rgb:ff/002/3a' and 'rgb:ff00/0020/3a00'.


'rgbi:<red>/<green>/<blue>' is similar to 'rgb:<red>/<green>/<blue>' except that the numbers are now floating point and between 0.0 and 1.0 (with an optional sign and an optional exponent introduced by e or e).

The following six color coordinate systems specify colors in a device-independent manner:













The numbers in all of these specifications are floating point, with optional sign and exponent.

SETFG,[r,g,b] sets the foreground color to the color defined by the RGBI values r (for red), g (for green), and b (for blue). All three numbers should be floating-point between 0.0 (absent) and 1.0 (maximum). The specification SETFG,[r,g,b] corresponds to SETFG,'rgbi:r/g/b'.

See also: setfg, setbg, plot, callig

Previous: , Up: Colors   [Contents][Index]