]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - doc/html/man/curs_color.3x.html
ncurses 6.4 - patch 20230617
[ncurses.git] / doc / html / man / curs_color.3x.html
index 591ed4081fbc33f17aab37023b5a80693e1f6b75..6a826ceb4686ccc0220c5d6b16dc3b4182745f0c 100644 (file)
@@ -1,6 +1,6 @@
-<!-- 
+<!--
   ****************************************************************************
-  * Copyright 2018-2019,2020 Thomas E. Dickey                                *
+  * Copyright 2018-2022,2023 Thomas E. Dickey                                *
   * Copyright 1998-2016,2017 Free Software Foundation, Inc.                  *
   *                                                                          *
   * Permission is hereby granted, free of charge, to any person obtaining a  *
   * sale, use or other dealings in this Software without prior written       *
   * authorization.                                                           *
   ****************************************************************************
-  * @Id: curs_color.3x,v 1.62 2020/02/02 23:34:34 tom Exp @
+  * @Id: curs_color.3x,v 1.70 2023/04/23 20:53:20 tom Exp @
 -->
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
 <HTML>
 <HEAD>
 <meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
 <meta name="generator" content="Manpage converted by man2html - see https://invisible-island.net/scripts/readme.html#others_scripts">
-<TITLE>curs_color 3x</TITLE>
+<TITLE>curs_color 3x 2023-04-23 ncurses 6.4 Library calls</TITLE>
 <link rel="author" href="mailto:bug-ncurses@gnu.org">
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+
 </HEAD>
 <BODY>
-<H1 class="no-header">curs_color 3x</H1>
+<H1 class="no-header">curs_color 3x 2023-04-23 ncurses 6.4 Library calls</H1>
 <PRE>
-<STRONG><A HREF="curs_color.3x.html">curs_color(3x)</A></STRONG>                                                  <STRONG><A HREF="curs_color.3x.html">curs_color(3x)</A></STRONG>
+<STRONG><A HREF="curs_color.3x.html">curs_color(3x)</A></STRONG>                   Library calls                  <STRONG><A HREF="curs_color.3x.html">curs_color(3x)</A></STRONG>
 
 
 
        <STRONG>bool</STRONG> <STRONG>has_colors(void);</STRONG>
        <STRONG>bool</STRONG> <STRONG>can_change_color(void);</STRONG>
 
-       <STRONG>int</STRONG> <STRONG>init_pair(short</STRONG> <STRONG>pair,</STRONG> <STRONG>short</STRONG> <STRONG>f,</STRONG> <STRONG>short</STRONG> <STRONG>b);</STRONG>
-       <STRONG>int</STRONG> <STRONG>init_color(short</STRONG> <STRONG>color,</STRONG> <STRONG>short</STRONG> <STRONG>r,</STRONG> <STRONG>short</STRONG> <STRONG>g,</STRONG> <STRONG>short</STRONG> <STRONG>b);</STRONG>
+       <STRONG>int</STRONG> <STRONG>init_pair(short</STRONG> <EM>pair</EM><STRONG>,</STRONG> <STRONG>short</STRONG> <EM>f</EM><STRONG>,</STRONG> <STRONG>short</STRONG> <EM>b</EM><STRONG>);</STRONG>
+       <STRONG>int</STRONG> <STRONG>init_color(short</STRONG> <EM>color</EM><STRONG>,</STRONG> <STRONG>short</STRONG> <EM>r</EM><STRONG>,</STRONG> <STRONG>short</STRONG> <EM>g</EM><STRONG>,</STRONG> <STRONG>short</STRONG> <EM>b</EM><STRONG>);</STRONG>
        /* extensions */
-       <STRONG>int</STRONG> <STRONG>init_extended_pair(int</STRONG> <STRONG>pair,</STRONG> <STRONG>int</STRONG> <STRONG>f,</STRONG> <STRONG>int</STRONG> <STRONG>b);</STRONG>
-       <STRONG>int</STRONG> <STRONG>init_extended_color(int</STRONG> <STRONG>color,</STRONG> <STRONG>int</STRONG> <STRONG>r,</STRONG> <STRONG>int</STRONG> <STRONG>g,</STRONG> <STRONG>int</STRONG> <STRONG>b);</STRONG>
+       <STRONG>int</STRONG> <STRONG>init_extended_pair(int</STRONG> <EM>pair</EM><STRONG>,</STRONG> <STRONG>int</STRONG> <EM>f</EM><STRONG>,</STRONG> <STRONG>int</STRONG> <EM>b</EM><STRONG>);</STRONG>
+       <STRONG>int</STRONG> <STRONG>init_extended_color(int</STRONG> <EM>color</EM><STRONG>,</STRONG> <STRONG>int</STRONG> <EM>r</EM><STRONG>,</STRONG> <STRONG>int</STRONG> <EM>g</EM><STRONG>,</STRONG> <STRONG>int</STRONG> <EM>b</EM><STRONG>);</STRONG>
 
-       <STRONG>int</STRONG> <STRONG>color_content(short</STRONG> <STRONG>color,</STRONG> <STRONG>short</STRONG> <STRONG>*r,</STRONG> <STRONG>short</STRONG> <STRONG>*g,</STRONG> <STRONG>short</STRONG> <STRONG>*b);</STRONG>
-       <STRONG>int</STRONG> <STRONG>pair_content(short</STRONG> <STRONG>pair,</STRONG> <STRONG>short</STRONG> <STRONG>*f,</STRONG> <STRONG>short</STRONG> <STRONG>*b);</STRONG>
+       <STRONG>int</STRONG> <STRONG>color_content(short</STRONG> <EM>color</EM><STRONG>,</STRONG> <STRONG>short</STRONG> <STRONG>*</STRONG><EM>r</EM><STRONG>,</STRONG> <STRONG>short</STRONG> <STRONG>*</STRONG><EM>g</EM><STRONG>,</STRONG> <STRONG>short</STRONG> <STRONG>*</STRONG><EM>b</EM><STRONG>);</STRONG>
+       <STRONG>int</STRONG> <STRONG>pair_content(short</STRONG> <EM>pair</EM><STRONG>,</STRONG> <STRONG>short</STRONG> <STRONG>*</STRONG><EM>f</EM><STRONG>,</STRONG> <STRONG>short</STRONG> <STRONG>*</STRONG><EM>b</EM><STRONG>);</STRONG>
        /* extensions */
-       <STRONG>int</STRONG> <STRONG>extended_color_content(int</STRONG> <STRONG>color,</STRONG> <STRONG>int</STRONG> <STRONG>*r,</STRONG> <STRONG>int</STRONG> <STRONG>*g,</STRONG> <STRONG>int</STRONG> <STRONG>*b);</STRONG>
-       <STRONG>int</STRONG> <STRONG>extended_pair_content(int</STRONG> <STRONG>pair,</STRONG> <STRONG>int</STRONG> <STRONG>*f,</STRONG> <STRONG>int</STRONG> <STRONG>*b);</STRONG>
+       <STRONG>int</STRONG> <STRONG>extended_color_content(int</STRONG> <EM>color</EM><STRONG>,</STRONG> <STRONG>int</STRONG> <STRONG>*</STRONG><EM>r</EM><STRONG>,</STRONG> <STRONG>int</STRONG> <STRONG>*</STRONG><EM>g</EM><STRONG>,</STRONG> <STRONG>int</STRONG> <STRONG>*</STRONG><EM>b</EM><STRONG>);</STRONG>
+       <STRONG>int</STRONG> <STRONG>extended_pair_content(int</STRONG> <EM>pair</EM><STRONG>,</STRONG> <STRONG>int</STRONG> <STRONG>*</STRONG><EM>f</EM><STRONG>,</STRONG> <STRONG>int</STRONG> <STRONG>*</STRONG><EM>b</EM><STRONG>);</STRONG>
 
        /* extensions */
        <STRONG>void</STRONG> <STRONG>reset_color_pairs(void);</STRONG>
 
-       <STRONG>int</STRONG> <STRONG>COLOR_PAIR(int</STRONG> <STRONG>n);</STRONG>
+       <STRONG>int</STRONG> <STRONG>COLOR_PAIR(int</STRONG> <EM>n</EM><STRONG>);</STRONG>
        <STRONG>PAIR_NUMBER(</STRONG><EM>attrs</EM><STRONG>);</STRONG>
 
 
 
        <STRONG>o</STRONG>   If the parameter passed to <STRONG>waddch</STRONG> is <EM>not</EM> <EM>blank</EM>, or it does not  use
            the  special  color  pair 0, <STRONG>curses</STRONG> prefers the color pair from the
-           parameter, if it is nonzero.  Otherwise, it tries  the  window  at-
-           tribute next, and finally the background character.
+           parameter, if it is nonzero.  Otherwise, it tries the window attri-
+           bute next, and finally the background character.
 
        Some  <STRONG>curses</STRONG>  functions such as <STRONG>wprintw</STRONG> call <STRONG>waddch</STRONG>.  Those do not com-
        bine its parameter with a color pair.  Consequently those calls use on-
        <STRONG>o</STRONG>   Color RGB values are not settable.
 
 
+</PRE><H2><a name="h2-HISTORY">HISTORY</a></H2><PRE>
+       SVr3.2 introduced color support to curses in 1987.
+
+       SVr4 made internal changes, e.g., moving  the  storage  for  the  color
+       state  from  <STRONG>SP</STRONG> (the <STRONG>SCREEN</STRONG> structure) to <STRONG>cur_term</STRONG> (the <STRONG>TERMINAL</STRONG> struc-
+       ture), but provided the same set of library functions.
+
+       SVr4 curses limits the number of color pairs  to  64,  reserving  color
+       pair  zero  (0)  as the terminal's initial uncolored state.  This limit
+       arises because the color pair information is a bitfield in  the  <STRONG>chtype</STRONG>
+       data type (denoted by <STRONG>A_COLOR</STRONG>).
+
+       Other implementations of curses had different limits:
+
+       <STRONG>o</STRONG>   PCCurses (1987-1990) provided for only eight (8) colors.
+
+       <STRONG>o</STRONG>   PDCurses  (1992-present)  inherited the 8-color limitation from PC-
+           Curses, but changed this to 256 in version 2.5 (2001),  along  with
+           changing <STRONG>chtype</STRONG> from 16-bits to 32-bits.
+
+       <STRONG>o</STRONG>   X/Open Curses (1992-present) added a new structure <STRONG>cchar_t</STRONG> to store
+           the character, attributes and color-pair values, allowing increased
+           range  of  color-pairs.   Both  color-pairs and color-values used a
+           signed <STRONG>short</STRONG>, limiting values to 15 bits.
+
+       <STRONG>o</STRONG>   ncurses (1992-present) uses eight bits for <STRONG>A_COLOR</STRONG> in  <STRONG>chtype</STRONG>  val-
+           ues.
+
+           Version  5.3  provided  a wide-character interface (2002), but left
+           color-pairs as part of the attributes-field.
+
+           Since version 6 (2015), ncurses uses a separate <STRONG>int</STRONG> for color-pairs
+           in the <STRONG>cchar_t</STRONG> values.  When those color-pair values fit in 8 bits,
+           ncurses allows color-pairs to be manipulated via the functions  us-
+           ing <STRONG>chtype</STRONG> values.
+
+       <STRONG>o</STRONG>   NetBSD  curses  used  6 bits from 2000 (when colors were first sup-
+           ported) until 2004.  At that point, NetBSD changed to use 10  bits.
+           As of 2021, that size is unchanged.  Like ncurses before version 6,
+           the NetBSD color-pair information is stored in the attributes field
+           of  <STRONG>cchar_t</STRONG>,  limiting the number of color-pairs by the size of the
+           bitfield.
+
+
 </PRE><H2><a name="h2-PORTABILITY">PORTABILITY</a></H2><PRE>
+
+</PRE><H3><a name="h3-Extensions">Extensions</a></H3><PRE>
+       The functions marked as extensions were designed for  <STRONG><A HREF="ncurses.3x.html">ncurses(3x)</A></STRONG>,  and
+       are not found in SVr4 curses, 4.4BSD curses, or any other previous ver-
+       sion of curses.
+
+
+</PRE><H3><a name="h3-Standards">Standards</a></H3><PRE>
        This implementation satisfies XSI Curses's minimum maximums for  <STRONG>COLORS</STRONG>
        and <STRONG>COLOR_PAIRS</STRONG>.
 
 
 
 
-                                                                <STRONG><A HREF="curs_color.3x.html">curs_color(3x)</A></STRONG>
+ncurses 6.4                       2023-04-23                    <STRONG><A HREF="curs_color.3x.html">curs_color(3x)</A></STRONG>
 </PRE>
 <div class="nav">
 <ul>
 </li>
 <li><a href="#h2-RETURN-VALUE">RETURN VALUE</a></li>
 <li><a href="#h2-NOTES">NOTES</a></li>
-<li><a href="#h2-PORTABILITY">PORTABILITY</a></li>
+<li><a href="#h2-HISTORY">HISTORY</a></li>
+<li><a href="#h2-PORTABILITY">PORTABILITY</a>
+<ul>
+<li><a href="#h3-Extensions">Extensions</a></li>
+<li><a href="#h3-Standards">Standards</a></li>
+</ul>
+</li>
 <li><a href="#h2-SEE-ALSO">SEE ALSO</a></li>
 </ul>
 </div>