terminfo.4 (2010 09)

t
terminfo(4) terminfo(4)
(ENHANCED CURSES)
The Tektronix method uses a set of N predefined colors (usually 8) from which an application can
select "current" foreground and background colors. Thus a terminal can support up to N colors
mixed into N*N color-pairs to be displayed on the screen at the same time.
Hewlett-Packard-style
In the HP method, the application cannot define the foreground independently of the back-
ground, or vice-versa. Instead, the application must define an entire color-pair at once. Up to M
color-pairs, made from 2*M different colors, can be defined this way.
The numeric variables colors and pairs define the number of colors and color-pairs that can be
displayed on the screen at the same time. If a terminal can change the definition of a color (for example,
the Tektronix 4100 and 4200 series terminals), this should be specified with ccc (can change color). To
change the definition of a color (Tektronix 4200 method), use initc (initialize color). It requires four
arguments: color number (ranging from 0 to colors1) and three RGB (red, green, and blue) values or
three HLS colors (Hue, Lightness, Saturation). Ranges of RGB and HLS values are terminal-dependent.
Tektronix 4100 series terminals only use HLS color notation. For such terminals (or dual-mode terminals
to be operated in HLS mode) one must define a boolean variable hls; that would instruct the
init_color() function (see can_change_color(3X)) to convert its RGB arguments to HLS before sending
them to the terminal. The last three arguments to the initc string would then be HLS values.
If a terminal can change the definitions of colors, but uses a color notation different from RGB and HLS, a
mapping to either RGB or HLS must be developed.
If the terminal supports ANSI escape sequences to set background and foreground, they should be coded
as setab and setaf, respectively. If the terminal supports other escape sequences to set background
and foreground, they should be coded as setb and setf, respectively. The vidputs() function (see
vidattr (3X)) and the refresh functions use setab and setaf if they are defined. Each of these capabili-
ties requires one argument: the number of the color. By convention, the first eight colors (07) map to, in
order: black, red, green, yellow, blue, magenta, cyan, white. However, color re-mapping may occur or the
underlying hardware may not support these colors. Mappings for any additional colors supported by the
device (that is, to numbers greater than 7) are at the discretion of the terminfo entry writer.
To initialize a color-pair (HP method), use initp (initialize pair). It requires seven arguments: the
number of a color-pair (range=0 to pairs1), and six RGB values: three for the foreground followed by
three for the background. (Each of these groups of three should be in the order RGB.) When initc or
initp are used, RGB or HLS arguments should be in the order "red, green, blue" or "hue, lightness,
saturation"), respectively. To make a color-pair current, use scp (set color-pair). It takes one argument,
the number of a color-pair.
Some terminals (for example, most color terminal emulators for PCs) erase areas of the screen with
current background color. In such cases, bce (background color erase) should be defined. The variable
op (original pair) contains a sequence for setting the foreground and the background colors to what they
were at the terminal start-up time. Similarly, oc (original colors) contains a control sequence for setting
all colors (for the Tektronix method) or color-pairs (for the HP method) to the values they had at the ter-
minal start-up time.
Some color terminals substitute color for video attributes. Such video attributes should not be combined
with colors. Information about these video attributes should be packed into the ncv (no color video) vari-
able. There is a one-to-one correspondence between the nine least significant bits of that variable and the
video attributes. The following table depicts this correspondence.
24 Hewlett-Packard Company 24 HP-UX 11i Version 3: September 2010