1 /****************************************************************************
2 * Copyright (c) 1998-2016,2017 Free Software Foundation, Inc. *
4 * Permission is hereby granted, free of charge, to any person obtaining a *
5 * copy of this software and associated documentation files (the *
6 * "Software"), to deal in the Software without restriction, including *
7 * without limitation the rights to use, copy, modify, merge, publish, *
8 * distribute, distribute with modifications, sublicense, and/or sell *
9 * copies of the Software, and to permit persons to whom the Software is *
10 * furnished to do so, subject to the following conditions: *
12 * The above copyright notice and this permission notice shall be included *
13 * in all copies or substantial portions of the Software. *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
16 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
17 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
18 * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
19 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
20 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
21 * THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
23 * Except as contained in this notice, the name(s) of the above copyright *
24 * holders shall not be used in advertising or otherwise to promote the *
25 * sale, use or other dealings in this Software without prior written *
27 ****************************************************************************/
29 /****************************************************************************
30 * Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
31 * and: Eric S. Raymond <esr@snark.thyrsus.com> *
32 * and: Thomas E. Dickey 1996-on *
33 * and: Juergen Pfeifer 2009 *
34 ****************************************************************************/
38 * Handles color emulation of SYS V curses
41 #define NEW_PAIR_INTERNAL 1
43 #include <curses.priv.h>
48 #define CUR SP_TERMTYPE
51 MODULE_ID("$Id: lib_color.c,v 1.116 2017/03/25 21:10:54 tom Exp $")
53 #ifdef USE_TERM_DRIVER
54 #define CanChange InfoOf(SP_PARM).canchange
55 #define DefaultPalette InfoOf(SP_PARM).defaultPalette
56 #define HasColor InfoOf(SP_PARM).hascolor
57 #define InitColor InfoOf(SP_PARM).initcolor
58 #define MaxColors InfoOf(SP_PARM).maxcolors
59 #define MaxPairs InfoOf(SP_PARM).maxpairs
60 #define UseHlsPalette (DefaultPalette == _nc_hls_palette)
62 #define CanChange can_change
63 #define DefaultPalette (hue_lightness_saturation ? hls_palette : cga_palette)
64 #define HasColor has_color
65 #define InitColor initialize_color
66 #define MaxColors max_colors
67 #define MaxPairs max_pairs
68 #define UseHlsPalette (hue_lightness_saturation)
71 #ifndef USE_TERM_DRIVER
73 * These should be screen structure members. They need to be globals for
74 * historical reasons. So we assign them in start_color() and also in
75 * set_term()'s screen-switching logic.
79 NCURSES_PUBLIC_VAR(COLOR_PAIRS) (void)
81 return SP ? SP->_pair_count : -1;
84 NCURSES_PUBLIC_VAR(COLORS) (void)
86 return SP ? SP->_color_count : -1;
89 NCURSES_EXPORT_VAR(int) COLOR_PAIRS = 0;
90 NCURSES_EXPORT_VAR(int) COLORS = 0;
92 #endif /* !USE_TERM_DRIVER */
94 #define DATA(r,g,b) {r,g,b, 0,0,0, 0}
96 #define TYPE_CALLOC(type,elts) typeCalloc(type, (unsigned)(elts))
100 #define OkColorHi(n) (((n) < COLORS) && ((n) < maxcolors))
101 #define InPalette(n) ((n) >= 0 && (n) < MAX_PALETTE)
104 * Given a RGB range of 0..1000, we'll normally set the individual values
105 * to about 2/3 of the maximum, leaving full-range for bold/bright colors.
110 static const color_t cga_palette[] =
113 DATA(RGB_OFF, RGB_OFF, RGB_OFF), /* COLOR_BLACK */
114 DATA(RGB_ON, RGB_OFF, RGB_OFF), /* COLOR_RED */
115 DATA(RGB_OFF, RGB_ON, RGB_OFF), /* COLOR_GREEN */
116 DATA(RGB_ON, RGB_ON, RGB_OFF), /* COLOR_YELLOW */
117 DATA(RGB_OFF, RGB_OFF, RGB_ON), /* COLOR_BLUE */
118 DATA(RGB_ON, RGB_OFF, RGB_ON), /* COLOR_MAGENTA */
119 DATA(RGB_OFF, RGB_ON, RGB_ON), /* COLOR_CYAN */
120 DATA(RGB_ON, RGB_ON, RGB_ON), /* COLOR_WHITE */
123 static const color_t hls_palette[] =
126 DATA( 0, 0, 0), /* COLOR_BLACK */
127 DATA( 120, 50, 100), /* COLOR_RED */
128 DATA( 240, 50, 100), /* COLOR_GREEN */
129 DATA( 180, 50, 100), /* COLOR_YELLOW */
130 DATA( 330, 50, 100), /* COLOR_BLUE */
131 DATA( 60, 50, 100), /* COLOR_MAGENTA */
132 DATA( 300, 50, 100), /* COLOR_CYAN */
133 DATA( 0, 50, 100), /* COLOR_WHITE */
136 #ifdef USE_TERM_DRIVER
137 NCURSES_EXPORT_VAR(const color_t*) _nc_cga_palette = cga_palette;
138 NCURSES_EXPORT_VAR(const color_t*) _nc_hls_palette = hls_palette;
143 #if NCURSES_EXT_FUNCS
145 * These are called from _nc_do_color(), which in turn is called from
146 * vidattr - so we have to assume that sp may be null.
149 default_fg(NCURSES_SP_DCL0)
151 return (SP_PARM != 0) ? SP_PARM->_default_fg : COLOR_WHITE;
155 default_bg(NCURSES_SP_DCL0)
157 return SP_PARM != 0 ? SP_PARM->_default_bg : COLOR_BLACK;
160 #define default_fg(sp) COLOR_WHITE
161 #define default_bg(sp) COLOR_BLACK
164 #ifndef USE_TERM_DRIVER
166 * SVr4 curses is known to interchange color codes (1,4) and (3,6), possibly
167 * to maintain compatibility with a pre-ANSI scheme. The same scheme is
168 * also used in the FreeBSD syscons.
171 toggled_colors(int c)
174 static const int table[] =
175 {0, 4, 2, 6, 1, 5, 3, 7,
176 8, 12, 10, 14, 9, 13, 11, 15};
184 set_background_color(NCURSES_SP_DCLx int bg, NCURSES_SP_OUTC outc)
186 #ifdef USE_TERM_DRIVER
187 CallDriver_3(SP_PARM, td_color, FALSE, bg, outc);
189 if (set_a_background) {
190 TPUTS_TRACE("set_a_background");
191 NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx
192 TPARM_1(set_a_background, bg),
195 TPUTS_TRACE("set_background");
196 NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx
197 TPARM_1(set_background, toggled_colors(bg)),
204 set_foreground_color(NCURSES_SP_DCLx int fg, NCURSES_SP_OUTC outc)
206 #ifdef USE_TERM_DRIVER
207 CallDriver_3(SP_PARM, td_color, TRUE, fg, outc);
209 if (set_a_foreground) {
210 TPUTS_TRACE("set_a_foreground");
211 NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx
212 TPARM_1(set_a_foreground, fg),
215 TPUTS_TRACE("set_foreground");
216 NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx
217 TPARM_1(set_foreground, toggled_colors(fg)),
224 init_color_table(NCURSES_SP_DCL0)
226 const color_t *tp = DefaultPalette;
231 for (n = 0; n < COLORS; n++) {
233 SP_PARM->_color_table[n] = tp[n];
235 SP_PARM->_color_table[n] = tp[n % MAX_PALETTE];
237 SP_PARM->_color_table[n].green = 100;
239 if (SP_PARM->_color_table[n].red)
240 SP_PARM->_color_table[n].red = 1000;
241 if (SP_PARM->_color_table[n].green)
242 SP_PARM->_color_table[n].green = 1000;
243 if (SP_PARM->_color_table[n].blue)
244 SP_PARM->_color_table[n].blue = 1000;
251 * Reset the color pair, e.g., to whatever color pair 0 is.
254 reset_color_pair(NCURSES_SP_DCL0)
256 #ifdef USE_TERM_DRIVER
257 return CallDriver(SP_PARM, td_rescol);
262 if (orig_pair != 0) {
263 (void) NCURSES_PUTP2("orig_pair", orig_pair);
271 * Reset color pairs and definitions. Actually we do both more to accommodate
272 * badly-written terminal descriptions than for the relatively rare case where
273 * someone has changed the color definitions.
276 NCURSES_SP_NAME(_nc_reset_colors) (NCURSES_SP_DCL0)
280 T((T_CALLED("_nc_reset_colors(%p)"), (void *) SP_PARM));
281 if (SP_PARM->_color_defs > 0)
282 SP_PARM->_color_defs = -(SP_PARM->_color_defs);
283 if (reset_color_pair(NCURSES_SP_ARG))
286 #ifdef USE_TERM_DRIVER
287 result = CallDriver(SP_PARM, td_rescolors);
289 if (orig_colors != 0) {
290 NCURSES_PUTP2("orig_colors", orig_colors);
299 _nc_reset_colors(void)
301 return NCURSES_SP_NAME(_nc_reset_colors) (CURRENT_SCREEN);
306 NCURSES_SP_NAME(start_color) (NCURSES_SP_DCL0)
309 int maxpairs = 0, maxcolors = 0;
311 T((T_CALLED("start_color(%p)"), (void *) SP_PARM));
315 } else if (SP_PARM->_coloron) {
319 maxcolors = MaxColors;
320 if (reset_color_pair(NCURSES_SP_ARG) != TRUE) {
321 set_foreground_color(NCURSES_SP_ARGx
322 default_fg(NCURSES_SP_ARG),
323 NCURSES_SP_NAME(_nc_outch));
324 set_background_color(NCURSES_SP_ARGx
325 default_bg(NCURSES_SP_ARG),
326 NCURSES_SP_NAME(_nc_outch));
328 #if !NCURSES_EXT_COLORS
330 * Without ext-colors, we cannot represent more than 256 color pairs.
336 if (maxpairs > 0 && maxcolors > 0) {
337 SP_PARM->_pair_limit = maxpairs;
339 #if NCURSES_EXT_FUNCS
341 * If using default colors, allocate extra space in table to
342 * allow for default-color as a component of a color-pair.
344 SP_PARM->_pair_limit += (1 + (2 * maxcolors));
345 SP_PARM->_pair_limit = limit_PAIRS(SP_PARM->_pair_limit);
347 SP_PARM->_pair_count = maxpairs;
348 SP_PARM->_color_count = maxcolors;
350 COLOR_PAIRS = maxpairs;
354 SP_PARM->_color_pairs = TYPE_CALLOC(colorpair_t, SP_PARM->_pair_limit);
355 if (SP_PARM->_color_pairs != 0) {
356 SP_PARM->_color_table = TYPE_CALLOC(color_t, maxcolors);
357 if (SP_PARM->_color_table != 0) {
358 MakeColorPair(SP_PARM->_color_pairs[0],
359 default_fg(NCURSES_SP_ARG),
360 default_bg(NCURSES_SP_ARG));
361 init_color_table(NCURSES_SP_ARG);
363 T(("started color: COLORS = %d, COLOR_PAIRS = %d",
364 COLORS, COLOR_PAIRS));
366 SP_PARM->_coloron = 1;
368 } else if (SP_PARM->_color_pairs != 0) {
369 FreeAndNull(SP_PARM->_color_pairs);
383 return NCURSES_SP_NAME(start_color) (CURRENT_SCREEN);
387 /* This function was originally written by Daniel Weaver <danw@znyx.com> */
389 rgb2hls(int r, int g, int b, int *h, int *l, int *s)
390 /* convert RGB to HLS system */
394 if ((min = g < r ? g : r) > b)
396 if ((max = g > r ? g : r) < b)
399 /* calculate lightness */
400 *l = ((min + max) / 20);
402 if (min == max) { /* black, white and all shades of gray */
408 /* calculate saturation */
410 *s = (((max - min) * 100) / (max + min));
412 *s = (((max - min) * 100) / (2000 - max - min));
416 t = (120 + ((g - b) * 60) / (max - min));
418 t = (240 + ((b - r) * 60) / (max - min));
420 t = (360 + ((r - g) * 60) / (max - min));
426 * Change all cells which use(d) a given color pair to force a repaint.
429 _nc_change_pair(SCREEN *sp, int pair)
433 for (y = 0; y <= CurScreen(sp)->_maxy; y++) {
434 struct ldat *ptr = &(CurScreen(sp)->_line[y]);
435 bool changed = FALSE;
436 for (x = 0; x <= CurScreen(sp)->_maxx; x++) {
437 if (GetPair(ptr->text[x]) == pair) {
438 /* Set the old cell to zero to ensure it will be
439 updated on the next doupdate() */
440 SetChar(ptr->text[x], 0, 0);
441 CHANGED_CELL(ptr, x);
446 NCURSES_SP_NAME(_nc_make_oldhash) (NCURSES_SP_ARGx y);
451 * Extension (1997/1/18) - Allow negative f/b values to set default color
455 _nc_init_pair(SCREEN *sp, int pair, int f, int b)
457 static colorpair_t null_pair;
458 colorpair_t result = null_pair;
459 colorpair_t previous;
462 T((T_CALLED("init_pair(%p,%d,%d,%d)"), (void *) sp, pair, f, b));
464 if (!ValidPair(sp, pair))
467 maxcolors = MaxColors;
469 previous = sp->_color_pairs[pair];
470 #if NCURSES_EXT_FUNCS
471 if (sp->_default_color || sp->_assumed_color) {
472 bool isDefault = FALSE;
473 bool wasDefault = FALSE;
474 int default_pairs = sp->_default_pairs;
477 * Map caller's color number, e.g., -1, 0, 1, .., 7, etc., into
478 * internal unsigned values which we will store in the _color_pairs[]
481 if (isDefaultColor(f)) {
484 } else if (!OkColorHi(f)) {
488 if (isDefaultColor(b)) {
491 } else if (!OkColorHi(b)) {
496 * Check if the table entry that we are going to init/update used
499 if (isDefaultColor(FORE_OF(previous))
500 || isDefaultColor(BACK_OF(previous)))
504 * Keep track of the number of entries in the color pair table which
505 * used a default color.
507 if (isDefault && !wasDefault) {
509 } else if (wasDefault && !isDefault) {
514 * As an extension, ncurses allows the pair number to exceed the
515 * terminal's color_pairs value for pairs using a default color.
517 * Note that updating a pair which used a default color with one
518 * that does not will decrement the count - and possibly interfere
519 * with sequentially adding new pairs.
521 if (pair > (sp->_pair_count + default_pairs)) {
524 sp->_default_pairs = default_pairs;
528 if ((f < 0) || !OkColorHi(f)
529 || (b < 0) || !OkColorHi(b)
536 * When a pair's content is changed, replace its colors (if pair was
537 * initialized before a screen update is performed replacing original
538 * pair colors with the new ones).
540 MakeColorPair(result, f, b);
541 if (FORE_OF(previous) != 0
542 && BACK_OF(previous) != 0
543 && !isSamePair(previous, result)) {
544 _nc_change_pair(sp, pair);
547 _nc_reset_color_pair(sp, pair, &result);
548 sp->_color_pairs[pair] = result;
549 _nc_set_color_pair(sp, pair, cpINIT);
551 if (GET_SCREEN_PAIR(sp) == pair)
552 SET_SCREEN_PAIR(sp, (int) (~0)); /* force attribute update */
554 #ifdef USE_TERM_DRIVER
555 CallDriver_3(sp, td_initpair, pair, f, b);
557 if (initialize_pair && InPalette(f) && InPalette(b)) {
558 const color_t *tp = DefaultPalette;
561 ("initializing pair: pair = %d, fg=(%d,%d,%d), bg=(%d,%d,%d)",
563 (int) tp[f].red, (int) tp[f].green, (int) tp[f].blue,
564 (int) tp[b].red, (int) tp[b].green, (int) tp[b].blue));
566 NCURSES_PUTP2("initialize_pair",
567 TPARM_7(initialize_pair,
582 NCURSES_SP_NAME(init_pair) (NCURSES_SP_DCLx
583 NCURSES_PAIRS_T pair,
587 return _nc_init_pair(SP_PARM, pair, f, b);
592 init_pair(NCURSES_COLOR_T pair, NCURSES_COLOR_T f, NCURSES_COLOR_T b)
594 return NCURSES_SP_NAME(init_pair) (CURRENT_SCREEN, pair, f, b);
598 #define okRGB(n) ((n) >= 0 && (n) <= 1000)
601 _nc_init_color(SCREEN *sp, int color, int r, int g, int b)
606 T((T_CALLED("init_color(%p,%d,%d,%d,%d)"),
614 maxcolors = MaxColors;
618 && (color >= 0 && OkColorHi(color))
619 && (okRGB(r) && okRGB(g) && okRGB(b))) {
621 sp->_color_table[color].init = 1;
622 sp->_color_table[color].r = r;
623 sp->_color_table[color].g = g;
624 sp->_color_table[color].b = b;
628 &sp->_color_table[color].red,
629 &sp->_color_table[color].green,
630 &sp->_color_table[color].blue);
632 sp->_color_table[color].red = r;
633 sp->_color_table[color].green = g;
634 sp->_color_table[color].blue = b;
637 #ifdef USE_TERM_DRIVER
638 CallDriver_4(sp, td_initcolor, color, r, g, b);
640 NCURSES_PUTP2("initialize_color",
641 TPARM_4(initialize_color, color, r, g, b));
643 sp->_color_defs = max(color + 1, sp->_color_defs);
651 NCURSES_SP_NAME(init_color) (NCURSES_SP_DCLx
652 NCURSES_COLOR_T color,
657 return _nc_init_color(SP_PARM, color, r, g, b);
662 init_color(NCURSES_COLOR_T color,
667 return NCURSES_SP_NAME(init_color) (CURRENT_SCREEN, color, r, g, b);
672 NCURSES_SP_NAME(can_change_color) (NCURSES_SP_DCL)
676 T((T_CALLED("can_change_color(%p)"), (void *) SP_PARM));
678 if (HasTerminal(SP_PARM) && (CanChange != 0)) {
687 can_change_color(void)
689 return NCURSES_SP_NAME(can_change_color) (CURRENT_SCREEN);
694 NCURSES_SP_NAME(has_colors) (NCURSES_SP_DCL0)
699 T((T_CALLED("has_colors()")));
700 if (HasTerminal(SP_PARM)) {
701 #ifdef USE_TERM_DRIVER
704 code = ((VALID_NUMERIC(max_colors) && VALID_NUMERIC(max_pairs)
705 && (((set_foreground != NULL)
706 && (set_background != NULL))
707 || ((set_a_foreground != NULL)
708 && (set_a_background != NULL))
709 || set_color_pair)) ? TRUE : FALSE);
719 return NCURSES_SP_NAME(has_colors) (CURRENT_SCREEN);
724 _nc_color_content(SCREEN *sp, int color, int *r, int *g, int *b)
729 T((T_CALLED("color_content(%p,%d,%p,%p,%p)"),
739 maxcolors = MaxColors;
741 if (color < 0 || !OkColorHi(color) || !sp->_coloron) {
744 int c_r = sp->_color_table[color].red;
745 int c_g = sp->_color_table[color].green;
746 int c_b = sp->_color_table[color].blue;
755 TR(TRACE_ATTRS, ("...color_content(%d,%d,%d,%d)",
756 color, c_r, c_g, c_b));
763 NCURSES_SP_NAME(color_content) (NCURSES_SP_DCLx
764 NCURSES_COLOR_T color,
769 int my_r, my_g, my_b;
770 int rc = _nc_color_content(SP_PARM, color, &my_r, &my_g, &my_b);
772 *r = limit_COLOR(my_r);
773 *g = limit_COLOR(my_g);
774 *b = limit_COLOR(my_b);
781 color_content(NCURSES_COLOR_T color,
786 return NCURSES_SP_NAME(color_content) (CURRENT_SCREEN, color, r, g, b);
791 _nc_pair_content(SCREEN *sp, int pair, int *f, int *b)
795 T((T_CALLED("pair_content(%p,%d,%p,%p)"),
801 if (!ValidPair(sp, pair)) {
804 int fg = FORE_OF(sp->_color_pairs[pair]);
805 int bg = BACK_OF(sp->_color_pairs[pair]);
807 #if NCURSES_EXT_FUNCS
808 if (isDefaultColor(fg))
810 if (isDefaultColor(bg))
819 TR(TRACE_ATTRS, ("...pair_content(%p,%d,%d,%d)",
822 (int) fg, (int) bg));
829 NCURSES_SP_NAME(pair_content) (NCURSES_SP_DCLx
830 NCURSES_PAIRS_T pair,
835 int rc = _nc_pair_content(SP_PARM, pair, &my_f, &my_b);
837 *f = limit_COLOR(my_f);
838 *b = limit_COLOR(my_b);
845 pair_content(NCURSES_COLOR_T pair, NCURSES_COLOR_T *f, NCURSES_COLOR_T *b)
847 return NCURSES_SP_NAME(pair_content) (CURRENT_SCREEN, pair, f, b);
852 NCURSES_SP_NAME(_nc_do_color) (NCURSES_SP_DCLx
856 NCURSES_SP_OUTC outc)
858 #ifdef USE_TERM_DRIVER
859 CallDriver_4(SP_PARM, td_docolor, old_pair, pair, reverse, outc);
861 int fg = COLOR_DEFAULT;
862 int bg = COLOR_DEFAULT;
866 if (!ValidPair(SP_PARM, pair)) {
868 } else if (pair != 0) {
869 if (set_color_pair) {
870 TPUTS_TRACE("set_color_pair");
871 NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx
872 TPARM_1(set_color_pair, pair),
875 } else if (SP_PARM != 0) {
876 if (_nc_pair_content(SP_PARM, pair, &fg, &bg) == ERR)
883 && _nc_pair_content(SP_PARM, old_pair, &old_fg, &old_bg) != ERR) {
884 if ((isDefaultColor(fg) && !isDefaultColor(old_fg))
885 || (isDefaultColor(bg) && !isDefaultColor(old_bg))) {
886 #if NCURSES_EXT_FUNCS
888 * A minor optimization - but extension. If "AX" is specified in
889 * the terminal description, treat it as screen's indicator of ECMA
890 * SGR 39 and SGR 49, and assume the two sequences are independent.
892 if (SP_PARM->_has_sgr_39_49
893 && isDefaultColor(old_bg)
894 && !isDefaultColor(old_fg)) {
895 NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx "\033[39m", 1, outc);
896 } else if (SP_PARM->_has_sgr_39_49
897 && isDefaultColor(old_fg)
898 && !isDefaultColor(old_bg)) {
899 NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx "\033[49m", 1, outc);
902 reset_color_pair(NCURSES_SP_ARG);
905 reset_color_pair(NCURSES_SP_ARG);
906 if (old_pair < 0 && pair <= 0)
910 #if NCURSES_EXT_FUNCS
911 if (isDefaultColor(fg))
912 fg = default_fg(NCURSES_SP_ARG);
913 if (isDefaultColor(bg))
914 bg = default_bg(NCURSES_SP_ARG);
923 TR(TRACE_ATTRS, ("setting colors: pair = %d, fg = %d, bg = %d", pair,
926 if (!isDefaultColor(fg)) {
927 set_foreground_color(NCURSES_SP_ARGx fg, outc);
929 if (!isDefaultColor(bg)) {
930 set_background_color(NCURSES_SP_ARGx bg, outc);
937 _nc_do_color(int old_pair, int pair, int reverse, NCURSES_OUTC outc)
939 SetSafeOutcWrapper(outc);
940 NCURSES_SP_NAME(_nc_do_color) (CURRENT_SCREEN,
948 #if USE_EXTENDED_COLORS
950 NCURSES_SP_NAME(init_extended_pair) (NCURSES_SP_DCLx int pair, int f, int b)
952 return _nc_init_pair(SP_PARM, pair, f, b);
956 NCURSES_SP_NAME(init_extended_color) (NCURSES_SP_DCLx
960 return _nc_init_color(SP_PARM, color, r, g, b);
964 NCURSES_SP_NAME(extended_color_content) (NCURSES_SP_DCLx
966 int *r, int *g, int *b)
968 return _nc_color_content(SP_PARM, color, r, g, b);
972 NCURSES_SP_NAME(extended_pair_content) (NCURSES_SP_DCLx
976 return _nc_pair_content(SP_PARM, pair, f, b);
981 init_extended_pair(int pair, int f, int b)
983 return NCURSES_SP_NAME(init_extended_pair) (CURRENT_SCREEN, pair, f, b);
987 init_extended_color(int color, int r, int g, int b)
989 return NCURSES_SP_NAME(init_extended_color) (CURRENT_SCREEN,
995 extended_color_content(int color, int *r, int *g, int *b)
997 return NCURSES_SP_NAME(extended_color_content) (CURRENT_SCREEN,
1003 extended_pair_content(int pair, int *f, int *b)
1005 return NCURSES_SP_NAME(extended_pair_content) (CURRENT_SCREEN, pair, f, b);