]> ncurses.scripts.mit.edu Git - ncurses.git/blob - doc/html/man/default_colors.3x.html
ncurses 5.2
[ncurses.git] / doc / html / man / default_colors.3x.html
1 <HTML>
2 <BODY>
3 <PRE>
4 <!-- Manpage converted by man2html 3.0.1 -->
5
6 </PRE>
7 <H2>NAME</H2><PRE>
8        <B>default_colors</B>:  <B>use_default_colors</B>, <B>assume_default_colors</B>
9        - use terminal's default colors
10
11
12 </PRE>
13 <H2>SYNOPSIS</H2><PRE>
14        <B>#include</B> <B>&lt;curses.h&gt;</B>
15
16        <B>int</B> <B>use_default_colors(void);</B>
17        <B>int</B> <B>assume_default_colors(int</B> <B>fg,</B> <B>int</B> <B>bg);</B>
18
19
20 </PRE>
21 <H2>DESCRIPTION</H2><PRE>
22        The <I>use</I><B>_</B><I>default</I><B>_</B><I>colors()</I> and <I>assume</I><B>_</B><I>default</I><B>_</B><I>colors()</I> func-
23        tions are extensions to the curses library.  They are used
24        with terminals that support ISO 6429 color, or equivalent.
25        These terminals allow the application to reset color to an
26        unspecified default value (e.g., with SGR 39 or SGR 49).
27
28        Applications that paint  a  colored  background  over  the
29        whole  screen  do not take advantage of SGR 39 and SGR 49.
30        Some applications are designed to work  with  the  default
31        background,  using  colors  only  for  text.  For example,
32        there are several implementations of the <B>ls</B> program  which
33        use  colors to denote different file types or permissions.
34        These "color ls" programs do not  necessarily  modify  the
35        background  color, typically using only the <I>setaf</I> terminfo
36        capability  to  set  the  foreground  color.   Full-screen
37        applications  that  use default colors can achieve similar
38        visual effects.
39
40        The first function, <I>use</I><B>_</B><I>default</I><B>_</B><I>colors()</I> tells the  curses
41        library  to  assign terminal default foreground/background
42        colors to color number  -1.  So  init_pair(x,COLOR_RED,-1)
43        will  initialize  pair  x as red on default background and
44        init_pair(x,-1,COLOR_BLUE)  will  initialize  pair  x   as
45        default foreground on blue.
46
47        The  other,  <I>assume</I><B>_</B><I>default</I><B>_</B><I>colors()</I> is a refinement which
48        tells which colors to paint for color pair 0.  This  func-
49        tion  recognizes  a special color number -1, which denotes
50        the default terminal color.
51
52        The following are equivalent:
53               <I>use</I><B>_</B><I>default</I><B>_</B><I>colors();</I>
54               <I>assume</I><B>_</B><I>default</I><B>_</B><I>colors(-1,-1);</I>
55
56        These are ncurses extensions.  For other curses  implemen-
57        tations,  color  number -1 does not mean anything, just as
58        for ncurses before a successful call  of  <I>use</I><B>_</B><I>default</I><B>_</B><I>col-</I>
59        <I>ors()</I> or <I>assume</I><B>_</B><I>default</I><B>_</B><I>colors()</I>.
60
61        Other  curses  implementations do not allow an application
62        to modify color pair 0.  They assume that  the  background
63        is COLOR_BLACK, but do not ensure that the color pair 0 is
64        painted to match the assumption.  If your application does
65        not use either <I>use</I><B>_</B><I>default</I><B>_</B><I>colors()</I> or <I>assume</I><B>_</B><I>default</I><B>_</B><I>col-</I>
66        <I>ors()</I> ncurses will paint a white  foreground  (text)  with
67        black background for color pair 0.
68
69
70 </PRE>
71 <H2>RETURN VALUE</H2><PRE>
72        These functions return the integer <B>ERR</B> upon failure and <B>OK</B>
73        on success.  They will fail if either  the  terminal  does
74        not  support  the <I>orig</I><B>_</B><I>pair</I> or <I>orig</I><B>_</B><I>colors</I> capability.  If
75        the <I>initialize</I><B>_</B><I>pair</I> capability is found,  this  causes  an
76        error as well.
77
78
79 </PRE>
80 <H2>NOTES</H2><PRE>
81        Associated with this extension, the <B><A HREF="init_pair.3x.html">init_pair(3x)</A></B> function
82        accepts negative arguments to specify  default  foreground
83        or background colors.
84
85
86 </PRE>
87 <H2>PORTABILITY</H2><PRE>
88        These  routines  are  specific  to ncurses.  They were not
89        supported on Version 7, BSD or System  V  implementations.
90        It  is recommended that any code depending on them be con-
91        ditioned using NCURSES_VERSION.
92
93
94 </PRE>
95 <H2>SEE ALSO</H2><PRE>
96        <B><A HREF="curs_color.3x.html">curs_color(3x)</A></B>, <B><A HREF="ded.1.html">ded(1)</A></B>.
97
98
99 </PRE>
100 <H2>AUTHOR</H2><PRE>
101        Thomas Dickey (from an analysis of  the  requirements  for
102        color xterm for XFree86 3.1.2C, February 1996).
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129 </PRE>
130 <HR>
131 <ADDRESS>
132 Man(1) output converted with
133 <a href="http://www.oac.uci.edu/indiv/ehood/man2html.html">man2html</a>
134 </ADDRESS>
135 </BODY>
136 </HTML>