]> ncurses.scripts.mit.edu Git - ncurses.git/blob - man/curs_color.3x
ncurses 6.5 - patch 20240504
[ncurses.git] / man / curs_color.3x
1 .\"***************************************************************************
2 .\" Copyright 2018-2023,2024 Thomas E. Dickey                                *
3 .\" Copyright 1998-2016,2017 Free Software Foundation, Inc.                  *
4 .\"                                                                          *
5 .\" Permission is hereby granted, free of charge, to any person obtaining a  *
6 .\" copy of this software and associated documentation files (the            *
7 .\" "Software"), to deal in the Software without restriction, including      *
8 .\" without limitation the rights to use, copy, modify, merge, publish,      *
9 .\" distribute, distribute with modifications, sublicense, and/or sell       *
10 .\" copies of the Software, and to permit persons to whom the Software is    *
11 .\" furnished to do so, subject to the following conditions:                 *
12 .\"                                                                          *
13 .\" The above copyright notice and this permission notice shall be included  *
14 .\" in all copies or substantial portions of the Software.                   *
15 .\"                                                                          *
16 .\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
17 .\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
18 .\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
19 .\" IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
20 .\" DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
21 .\" OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
22 .\" THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
23 .\"                                                                          *
24 .\" Except as contained in this notice, the name(s) of the above copyright   *
25 .\" holders shall not be used in advertising or otherwise to promote the     *
26 .\" sale, use or other dealings in this Software without prior written       *
27 .\" authorization.                                                           *
28 .\"***************************************************************************
29 .\"
30 .\" $Id: curs_color.3x,v 1.100 2024/04/20 21:24:19 tom Exp $
31 .TH curs_color 3X 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls"
32 .ie \n(.g \{\
33 .ds `` \(lq
34 .ds '' \(rq
35 .\}
36 .el \{\
37 .ie t .ds `` ``
38 .el   .ds `` ""
39 .ie t .ds '' ''
40 .el   .ds '' ""
41 .\}
42 .
43 .de bP
44 .ie n  .IP \(bu 4
45 .el    .IP \(bu 2
46 ..
47 .
48 .SH NAME
49 \fB\%start_color\fP,
50 \fB\%has_colors\fP,
51 \fB\%can_change_color\fP,
52 \fB\%init_pair\fP,
53 \fB\%init_color\fP,
54 \fB\%init_extended_pair\fP,
55 \fB\%init_extended_color\fP,
56 \fB\%color_content\fP,
57 \fB\%pair_content\fP,
58 \fB\%extended_color_content\fP,
59 \fB\%extended_pair_content\fP,
60 \fB\%reset_color_pairs\fP,
61 \fB\%COLOR_PAIR\fP,
62 \fB\%PAIR_NUMBER\fP,
63 \fB\%COLORS\fP,
64 \fB\%COLOR_PAIRS\fP,
65 \fB\%COLOR_BLACK\fP,
66 \fB\%COLOR_RED\fP,
67 \fB\%COLOR_GREEN\fP,
68 \fB\%COLOR_YELLOW\fP,
69 \fB\%COLOR_BLUE\fP,
70 \fB\%COLOR_MAGENTA\fP,
71 \fB\%COLOR_CYAN\fP,
72 \fB\%COLOR_WHITE\fP \-
73 manipulate terminal colors with \fIcurses\fR
74 .SH SYNOPSIS
75 .nf
76 \fB#include <curses.h>
77 .PP
78 \fI/* variables */
79 \fBint COLOR_PAIRS;
80 \fBint COLORS;
81 .PP
82 \fBint start_color(void);
83 .PP
84 \fBbool has_colors(void);
85 \fBbool can_change_color(void);
86 .PP
87 \fBint init_pair(short \fIpair\fP, short \fIf\fP, short \fIb\fP);
88 \fBint init_color(short \fIcolor\fP, short \fIr\fP, short \fIg\fP, short \fIb\fP);
89 \fI/* extensions */
90 \fBint init_extended_pair(int \fIpair\fP, int \fIf\fP, int \fIb\fP);
91 \fBint init_extended_color(int \fIcolor\fP, int \fIr\fP, int \fIg\fP, int \fIb\fP);
92 .PP
93 \fBint color_content(short \fIcolor\fP, short *\fIr\fP, short *\fIg\fP, short *\fIb\fP);
94 \fBint pair_content(short \fIpair\fP, short *\fIf\fP, short *\fIb\fP);
95 \fI/* extensions */
96 \fBint extended_color_content(int \fIcolor\fP, int *\fIr\fP, int *\fIg\fP, int *\fIb\fP);
97 \fBint extended_pair_content(int \fIpair\fP, int *\fIf\fP, int *\fIb\fP);
98 .PP
99 \fI/* extension */
100 \fBvoid reset_color_pairs(void);
101 .PP
102 \fBint COLOR_PAIR(int \fIn\fP);
103 \fBPAIR_NUMBER(int \fIattr\fP);
104 .fi
105 .SH DESCRIPTION
106 .SS Overview
107 \fIcurses\fP supports color attributes on terminals with that
108 capability.
109 Call \fB\%start_color\fP
110 (typically right after \fB\%initscr\fP(3X))
111 to enable this feature.
112 Colors are always used in pairs.
113 A
114 .I "color pair"
115 couples a foreground color for characters with a background color for
116 the blank field on which characters are rendered.
117 \fB\%init_pair\fP initializes a color pair.
118 The macro \fB\%COLOR_PAIR\fP(\fIn\fP) can then convert the pair to a
119 video attribute.
120 .PP
121 If a terminal has the relevant capability,
122 \fB\%init_color\fP permits (re)definition of a color.
123 \fB\%has_colors\fP and \fB\%can_change_color\fP
124 return \fBTRUE\fP or \fBFALSE\fP,
125 depending on whether the terminal has color capability and whether the
126 programmer can change the colors.
127 \fB\%color_content\fP permits extraction of the
128 red,
129 green,
130 and blue components of an initialized color.
131 \fB\%pair_content\fP permits discovery of a color pair's current
132 definition.
133 .SS Rendering
134 .I curses
135 combines the following data to render a character cell.
136 Any of them can include color information.
137 .bP
138 .I curses
139 character attributes,
140 as from \fB\%waddch\fP(3X) or \fB\%wadd_wch\fP(3X)
141 .bP
142 window attributes,
143 as from \fB\%wattrset\fP(3X) or \fB\%wattr_set\fP(3X)
144 .bP
145 window background character attributes,
146 as from \fB\%wbkgdset\fP(3X) or \fB\%wbkgrndset\fP(3X)
147 .PP
148 Per-character and window attributes are usually set through a function
149 parameter containing attributes including a color pair value.
150 Some functions,
151 such as \fB\%wattr_set\fP,
152 use a separate color pair number parameter.
153 .PP
154 The background character is a special case:
155 it includes a character code,
156 just as if it were passed to \fB\%waddch\fP.
157 .PP
158 The \fIcurses\fP library does the actual work of combining these color
159 pairs in an internal function called from \fB\%waddch\fP:
160 .bP
161 If the parameter passed to \fB\%waddch\fP is \fIblank\fP,
162 and it uses the special color pair 0,
163 .RS
164 .bP
165 \fIcurses\fP next checks the window attribute.
166 .bP
167 If the window attribute does not use color pair 0,
168 \fIcurses\fP uses the color pair from the window attribute.
169 .bP
170 Otherwise, \fIcurses\fP uses the background character.
171 .RE
172 .bP
173 If the parameter passed to \fB\%waddch\fP is \fInot blank\fP,
174 or it does not use the special color pair 0,
175 \fIcurses\fP prefers the color pair from the parameter,
176 if it is nonzero.
177 Otherwise, it tries the window attribute next, and finally the
178 background character.
179 .PP
180 Some \fIcurses\fP functions such as \fB\%wprintw\fP call \fB\%waddch\fP.
181 Those do not combine its parameter with a color pair.
182 Consequently those calls use only the window attribute or
183 the background character.
184 .SH CONSTANTS
185 In \fB\%<curses.h>\fP the following macros are defined.
186 These are the standard colors (ISO-6429).
187 \fIcurses\fP also assumes that \fB\%COLOR_BLACK\fP is the default
188 background color for all terminals.
189 .PP
190 .nf
191       \fBCOLOR_BLACK\fP
192       \fBCOLOR_RED\fP
193       \fBCOLOR_GREEN\fP
194       \fBCOLOR_YELLOW\fP
195       \fBCOLOR_BLUE\fP
196       \fBCOLOR_MAGENTA\fP
197       \fBCOLOR_CYAN\fP
198       \fBCOLOR_WHITE\fP
199 .fi
200 .PP
201 Some terminals support more than the eight (8) \*(``ANSI\*('' colors.
202 There are no standard names for those additional colors.
203 .SH VARIABLES
204 .SS COLORS
205 is initialized by \fB\%start_color\fP to the maximum number of colors
206 the terminal can support.
207 .SS COLOR_PAIRS
208 is initialized by \fB\%start_color\fP to the maximum number of color
209 pairs the terminal can support.
210 Often,
211 its value is the product \fB\%COLORS\fP \(mu \fB\%COLORS\fP,
212 but this is not always true.
213 .bP
214 A few terminals use the HLS color space
215 (see \fB\%start_color\fP below),
216 ignoring this rule;
217 and
218 .bP
219 terminals supporting a large number of colors are limited to the number
220 of color pairs that a
221 .I "signed short"
222 value can represent.
223 .SH FUNCTIONS
224 .SS start_color
225 The \fB\%start_color\fP routine requires no arguments.
226 It must be called if the programmer wants to use colors, and before any other
227 color manipulation routine is called.
228 It is good practice to call this routine right after \fB\%initscr\fP.
229 \fB\%start_color\fP does this:
230 .bP
231 It initializes two global variables, \fB\%COLORS\fP and
232 \fB\%COLOR_PAIRS\fP (respectively defining the maximum number of colors
233 and color pairs the terminal can support).
234 .bP
235 It initializes the special color pair \fB\%0\fP to the default foreground
236 and background colors.
237 No other color pairs are initialized.
238 .bP
239 It restores the colors on the terminal to the values
240 they had when the terminal was just turned on.
241 .bP
242 If the terminal supports the \fBinitc\fP \%(\fBinitialize_color\fP) capability,
243 \fB\%start_color\fP
244 initializes its internal table representing the
245 red, green, and blue components of the color palette.
246 .IP
247 The components depend on whether the terminal uses
248 CGA (aka \*(``ANSI\*('') or
249 HLS (i.e., the \fBhls\fP \%(\fBhue_lightness_saturation\fP) capability is set).
250 The table is initialized first for eight basic colors
251 (black, red, green, yellow, blue, magenta, cyan, and white),
252 using weights that depend upon the CGA/HLS choice.
253 For \*(``ANSI\*('' colors the weights are \fB680\fP or \fB0\fP
254 depending on whether the corresponding
255 red, green, or blue component is used or not.
256 That permits using \fB1000\fP to represent bold/bright colors.
257 After the initial eight colors
258 (if the terminal supports more than eight colors)
259 the components are initialized using the same pattern,
260 but with weights of \fB1000\fP.
261 SVr4 uses a similar scheme, but uses \fB1000\fP
262 for the components of the initial eight colors.
263 .IP
264 \fB\%start_color\fP does not attempt to set the terminal's color palette
265 to match its built-in table.
266 An application may use \fB\%init_color\fP to alter the internal table
267 along with the terminal's color.
268 .PP
269 These limits apply to color values and color pairs.
270 Values outside these limits are not valid, and may result in a runtime error:
271 .bP
272 \fBCOLORS\fP corresponds to the terminal database's \fB\%max_colors\fP capability,
273 (see \fB\%terminfo\fP(5)).
274 .bP
275 color values are expected to be in the range \fB0\fP to \fB\%COLORS\-1\fP,
276 inclusive (including \fB0\fP and \fB\%COLORS\-1\fP).
277 .bP
278 a special color value \fB\-1\fP is used in certain extended functions
279 to denote the \fIdefault color\fP (see \fB\%use_default_colors\fP(3X)).
280 .bP
281 \fB\%COLOR_PAIRS\fP corresponds to
282 the terminal database's \fB\%max_pairs\fP capability,
283 (see \fB\%terminfo\fP(5)).
284 .bP
285 valid color pair values are in the range \fB1\fP to \fB\%COLOR_PAIRS\-1\fP,
286 inclusive.
287 .bP
288 color pair \fB0\fP is special; it denotes \*(``no color\*(''.
289 .IP
290 Color pair \fB0\fP is assumed to be white on black,
291 but is actually whatever the terminal implements before color is initialized.
292 It cannot be modified by the application.
293 .SS has_colors
294 The \fB\%has_colors\fP routine requires no arguments.
295 It returns \fBTRUE\fP if
296 the terminal can manipulate colors; otherwise, it returns \fBFALSE\fP.
297 This routine facilitates writing terminal-independent programs.
298 For example, a programmer can use it to decide
299 whether to use color or some other video attribute.
300 .SS can_change_color
301 The \fB\%can_change_color\fP routine requires no arguments.
302 It returns \fBTRUE\fP if the terminal supports colors
303 and can change their definitions;
304 other, it returns \fBFALSE\fP.
305 This routine facilitates writing terminal-independent programs.
306 .SS init_pair
307 The \fB\%init_pair\fP routine changes the definition of a color pair.
308 It takes three arguments:
309 the number of the color pair to be changed, the foreground
310 color number, and the background color number.
311 For portable applications:
312 .bP
313 The first argument must be a valid color pair value.
314 If default colors are used (see \fB\%use_default_colors\fP(3X))
315 the upper limit is adjusted to allow for extra pairs which use
316 a default color in foreground and/or background.
317 .bP
318 The second and third arguments must be valid color values.
319 .PP
320 If the color pair was previously initialized,
321 the screen is refreshed and all occurrences of that color pair
322 are changed to the new definition.
323 .PP
324 As an extension,
325 \fI\%ncurses\fP allows you to set color pair \fB0\fP via the
326 \fB\%assume_default_colors\fP(3X) routine, or to specify the use of
327 default colors (color number \fB\-1\fP) if you first invoke the
328 \fB\%use_default_colors\fP(3X) routine.
329 .SS init_extended_pair
330 Because \fB\%init_pair\fP uses signed \fBshort\fPs for its parameters,
331 that limits color pairs and color-values
332 to 32767 on modern hardware.
333 The extension \fB\%init_extended_pair\fP uses \fBint\fPs
334 for the color pair and color-value,
335 allowing a larger number of colors to be supported.
336 .SS init_color
337 The \fB\%init_color\fP routine changes the definition of a color.
338 It takes four arguments:
339 the number of the color to be changed followed by three RGB values
340 (for the amounts of red, green, and blue components).
341 .bP
342 The first argument must be a valid color value;
343 default colors are not allowed here.
344 (See the section \fB\%Colors\fP for the default color index.)
345 .bP
346 Each of the last three arguments
347 must be a value in the range \fB0\fP through \fB1000\fP.
348 .PP
349 When \fB\%init_color\fP is used, all
350 occurrences of that color on the screen immediately change to the new
351 definition.
352 .SS init_extended_color
353 Because \fB\%init_color\fP uses signed \fBshort\fPs for its parameters,
354 that limits color-values and their red, green, and blue components
355 to 32767 on modern hardware.
356 The extension \fB\%init_extended_color\fP uses \fBint\fPs
357 for the color value and
358 for setting the red, green, and blue components,
359 allowing a larger number of colors to be supported.
360 .SS color_content
361 The \fB\%color_content\fP routine gives programmers a way to find the intensity
362 of the red, green, and blue (RGB) components in a color.
363 It requires four arguments: the color number, and three addresses
364 of \fBshort\fRs for storing
365 the information about the amounts of red, green, and blue components in the
366 given color.
367 .bP
368 The first argument must be a valid color value, i.e.,
369 \fB0\fP through \fB\%COLORS\-1\fP, inclusive.
370 .bP
371 The values that are stored at the addresses pointed to by the
372 last three arguments are in the range
373 \fB0\fP (no component) through \fB1000\fP
374 (maximum amount of component), inclusive.
375 .SS extended_color_content
376 Because \fB\%color_content\fP uses signed \fBshort\fPs for its parameters,
377 that limits color-values and their red, green, and blue components
378 to 32767 on modern hardware.
379 The extension \fB\%extended_color_content\fP uses \fBint\fPs
380 for the color value and
381 for returning the red, green, and blue components,
382 allowing a larger number of colors to be supported.
383 .SS pair_content
384 The \fB\%pair_content\fP routine allows programmers to find out what colors a
385 given color pair consists of.
386 It requires three arguments: the color pair
387 number, and two addresses of \fBshort\fRs for storing the foreground and the
388 background color numbers.
389 .bP
390 The first argument must be a valid color value,
391 i.e., in the range \fB1\fP through \fB\%COLOR_PAIRS\-1\fP, inclusive.
392 .bP
393 The values that are stored at the addresses pointed
394 to by the second and third arguments are in the
395 range \fB0\fP through \fB\%COLORS\fP, inclusive.
396 .SS extended_pair_content
397 Because \fB\%pair_content\fP uses signed \fBshort\fPs for its parameters,
398 that limits color pair and color-values to 32767 on modern hardware.
399 The extension \fB\%extended_pair_content\fP uses \fBint\fPs
400 for the color pair and
401 for returning the foreground and background colors,
402 allowing a larger number of colors to be supported.
403 .SS reset_color_pairs
404 The extension \fB\%reset_color_pairs\fP tells \fI\%ncurses\fP to discard
405 all of the color pair information which was set with \fB\%init_pair\fP.
406 It also touches the current- and standard-screens, allowing an application to
407 switch color palettes rapidly.
408 .SS COLOR_PAIR
409 \fB\%COLOR_PAIR(\fIn\fB)\fR converts a color pair number to an
410 attribute.
411 Attributes can hold color pairs in the range 0 to 255.
412 If you need a color pair larger than that,
413 you must use functions such as \fB\%attr_set\fP
414 (which pass the color pair as a separate parameter)
415 rather than the legacy functions such as \fB\%attrset\fP.
416 .SS PAIR_NUMBER
417 \fB\%PAIR_NUMBER(\fIattr\fR) extracts the color information from its
418 \fIattr\fP parameter and returns it as a color pair number;
419 it is the inverse operation of \fB\%COLOR_PAIR\fP.
420 .SH RETURN VALUE
421 The routines \fB\%can_change_color\fP and \fB\%has_colors\fP return \fBTRUE\fP
422 or \fBFALSE\fP.
423 .PP
424 All other routines return the integer \fBERR\fP upon failure and an \fBOK\fP
425 (SVr4 specifies only \*(``an integer value
426 other than \fBERR\fP\*('') upon successful completion.
427 .PP
428 X/Open defines no error conditions.
429 SVr4 does document some error conditions which apply in general:
430 .bP
431 This implementation will return \fBERR\fP on attempts to
432 use color values outside the range \fB0\fP to \fB\%COLORS\fP\-1
433 (except for the default colors extension),
434 or use color pairs outside the range \fB0\fP to \fB\%COLOR_PAIRS\-1\fP.
435 .IP
436 Color values used in \fB\%init_color\fP must be
437 in the range \fB0\fP to \fB1000\fP.
438 .IP
439 An error is returned from all functions
440 if the terminal has not been initialized.
441 .IP
442 An error is returned from secondary functions such as \fB\%init_pair\fP
443 if \fB\%start_color\fP was not called.
444 .bP
445 SVr4 does much the same, except that
446 it returns \fBERR\fP from \fB\%pair_content\fP if the pair was not initialized
447 using \fB\%init_pairs\fP
448 and
449 it returns \fBERR\fP from \fB\%color_content\fP
450 if the terminal does not support changing colors.
451 .IP
452 This implementation does not return \fBERR\fP for either case.
453 .PP
454 Specific functions make additional checks:
455 .RS 3
456 .TP 5
457 \fB\%init_color\fP
458 returns an error if the terminal does not support
459 this feature, e.g., if the \fB\%initialize_color\fP capability is absent
460 from the terminal description.
461 .TP 5
462 \fB\%start_color\fP
463 returns an error if the color table cannot be allocated.
464 .RE
465 .SH NOTES
466 In the \fI\%ncurses\fP implementation,
467 there is a separate color activation flag,
468 color palette, color pairs table,
469 and associated \fB\%COLORS\fP and \fB\%COLOR_PAIRS\fP counts
470 for each screen; the \fB\%start_color\fP function only affects the current
471 screen.
472 The SVr4/XSI interface is not really designed with this in mind, and
473 historical implementations may use a single shared color palette.
474 .PP
475 Setting an implicit background color via a color pair affects only
476 character cells that a character write operation explicitly touches.
477 To change
478 the background color used when parts of a window are blanked by erasing or
479 scrolling operations, see \fB\%curs_bkgd\fP(3X).
480 .PP
481 Several caveats apply on older x86 machines
482 (e.g., i386, i486) with VGA-compatible graphics:
483 .bP
484 COLOR_YELLOW is actually brown.
485 To get yellow, use COLOR_YELLOW combined with the \fBA_BOLD\fP attribute.
486 .bP
487 The A_BLINK attribute should in theory cause the background to go bright.
488 This often fails to work, and even some cards for which it mostly works
489 (such as the
490 Paradise and compatibles) do the wrong thing when you try to set a bright
491 \*(``yellow\*('' background (you get a blinking yellow foreground instead).
492 .bP
493 Color RGB values are not settable.
494 .SH EXTENSIONS
495 The functions marked as extensions were designed for
496 \fB\%ncurses\fP(3X),
497 and are not found in SVr4
498 .IR curses ,
499 4.4BSD
500 .IR curses ,
501 or any other previous curses implementation.
502 .SH PORTABILITY
503 Applications employing
504 .I \%ncurses
505 extensions should condition their use on the visibility of the
506 .B \%NCURSES_VERSION
507 preprocessor macro.
508 .PP
509 This implementation satisfies X/Open Curses's minimum maximums
510 for \fB\%COLORS\fP and \fB\%COLOR_PAIRS\fP.
511 .PP
512 The \fB\%init_pair\fP routine accepts negative values of foreground
513 and background color to support the \fB\%use_default_colors\fP(3X) extension,
514 but only if that routine has been first invoked.
515 .PP
516 The assumption that \fB\%COLOR_BLACK\fP is the default
517 background color for all terminals can be modified using the
518 \fB\%assume_default_colors\fP(3X) extension.
519 .PP
520 This implementation checks the pointers,
521 e.g., for the values returned by
522 \fB\%color_content\fP and \fB\%pair_content\fP,
523 and will treat those as optional parameters when null.
524 .PP
525 X/Open Curses does not specify a limit for the number of colors and
526 color pairs which a terminal can support.
527 However, in its use of \fBshort\fP for the parameters,
528 it carries over SVr4's implementation detail for the compiled
529 terminfo database, which uses signed 16-bit numbers.
530 This implementation provides extended versions of those functions
531 which use \fBshort\fP parameters,
532 allowing applications to use larger color- and pair-numbers.
533 .PP
534 The \fB\%reset_color_pairs\fP function is an extension of
535 \fI\%ncurses\fP.
536 .SH HISTORY
537 SVr3.2 introduced color support to curses in 1987.
538 .PP
539 SVr4 made internal changes,
540 e.g., moving the storage for the color state
541 from \fBSP\fP (the \fISCREEN\fP structure)
542 to \fB\%cur_term\fP (the \fI\%TERMINAL\fP structure),
543 but provided the same set of library functions.
544 .PP
545 SVr4 curses limits the number of color pairs to 64,
546 reserving color pair zero (0) as the terminal's initial uncolored state.
547 This limit arises because the color pair information is a bitfield
548 in the \fB\%chtype\fP data type (denoted by \fB\%A_COLOR\fP).
549 .PP
550 Other implementations of curses had different limits:
551 .bP
552 PCCurses (1987-1990) provided for only eight (8) colors.
553 .bP
554 PDCurses (1992-present) inherited the 8-color limitation from PCCurses,
555 but changed this to 256 in version 2.5 (2001),
556 along with changing \fB\%chtype\fP from 16-bits to 32-bits.
557 .bP
558 X/Open Curses (1992-present)
559 added a new structure \fB\%cchar_t\fP to store the character,
560 attributes and color pair values, allowing increased range of color pairs.
561 Both color pairs and color-values used a signed \fBshort\fP,
562 limiting values to 15 bits.
563 .bP
564 \fI\%ncurses\fP (1992-present) uses eight bits
565 for \fB\%A_COLOR\fP in \fB\%chtype\fP values.
566 .IP
567 Version 5.3 provided a wide-character interface (2002),
568 but left color pairs as part of the attributes-field.
569 .IP
570 Since version 6 (2015),
571 ncurses uses a separate \fBint\fP for color pairs in the \fB\%cchar_t\fP values.
572 When those color pair values fit in 8 bits,
573 ncurses allows color pairs to be manipulated
574 via the functions using \fB\%chtype\fP values.
575 .bP
576 NetBSD curses used 6 bits from
577 2000 (when colors were first supported) until 2004.
578 At that point, NetBSD changed to use 10 bits.
579 As of 2021, that size is unchanged.
580 Like \fI\%ncurses\fP before version 6,
581 the NetBSD color pair information is stored in
582 the attributes field of \fB\%cchar_t\fP, limiting the number of color pairs
583 by the size of the bitfield.
584 .SH SEE ALSO
585 \fB\%curses\fP(3X),
586 \fB\%curs_attr\fP(3X),
587 \fB\%curs_initscr\fP(3X),
588 \fB\%curs_variables\fP(3X),
589 \fB\%default_colors\fP(3X)