libncurses: updated to 6.0
[tomato.git] / release / src / router / libncurses / doc / html / man / default_colors.3x.html
blob46e1fdfbe54ef50619468384a34233b87e4c3764
1 <!--
2 ****************************************************************************
3 * Copyright (c) 1998-2010,2011 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 * Author: Thomas E. Dickey 1997,1999,2000,2005
30 * @Id: default_colors.3x,v 1.23 2011/01/03 21:52:27 Tim.van.der.Molen Exp @
31 -->
32 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
33 <HTML>
34 <HEAD>
35 <meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
36 <meta name="generator" content="Manpage converted by man2html - see http://invisible-island.net/scripts/readme.html#others_scripts">
37 <TITLE>default_colors 3x</TITLE>
38 <link rev=made href="mailto:bug-ncurses@gnu.org">
39 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
40 </HEAD>
41 <BODY>
42 <H1 class="no-header">default_colors 3x</H1>
43 <PRE>
44 <STRONG><A HREF="default_colors.3x.html">default_colors(3x)</A></STRONG> <STRONG><A HREF="default_colors.3x.html">default_colors(3x)</A></STRONG>
49 </PRE>
50 <H2><a name="h2-NAME">NAME</a></H2><PRE>
51 <STRONG>use_default_colors</STRONG>, <STRONG>assume_default_colors</STRONG> - use terminal's
52 default colors
55 </PRE>
56 <H2><a name="h2-SYNOPSIS">SYNOPSIS</a></H2><PRE>
57 <STRONG>#include</STRONG> <STRONG>&lt;curses.h&gt;</STRONG>
59 <STRONG>int</STRONG> <STRONG>use_default_colors(void);</STRONG>
60 <STRONG>int</STRONG> <STRONG>assume_default_colors(int</STRONG> <STRONG>fg,</STRONG> <STRONG>int</STRONG> <STRONG>bg);</STRONG>
63 </PRE>
64 <H2><a name="h2-DESCRIPTION">DESCRIPTION</a></H2><PRE>
65 The <EM>use</EM><STRONG>_</STRONG><EM>default</EM><STRONG>_</STRONG><EM>colors()</EM> and <EM>assume</EM><STRONG>_</STRONG><EM>default</EM><STRONG>_</STRONG><EM>colors()</EM> func-
66 tions are extensions to the curses library. They are used
67 with terminals that support ISO 6429 color, or equivalent.
68 These terminals allow the application to reset color to an
69 unspecified default value (e.g., with SGR 39 or SGR 49).
71 Applications that paint a colored background over the
72 whole screen do not take advantage of SGR 39 and SGR 49.
73 Some applications are designed to work with the default
74 background, using colors only for text. For example,
75 there are several implementations of the <STRONG>ls</STRONG> program which
76 use colors to denote different file types or permissions.
77 These "color ls" programs do not necessarily modify the
78 background color, typically using only the <EM>setaf</EM> terminfo
79 capability to set the foreground color. Full-screen
80 applications that use default colors can achieve similar
81 visual effects.
83 The first function, <EM>use</EM><STRONG>_</STRONG><EM>default</EM><STRONG>_</STRONG><EM>colors()</EM> tells the curses
84 library to assign terminal default foreground/background
85 colors to color number -1. So init_pair(x,COLOR_RED,-1)
86 will initialize pair x as red on default background and
87 init_pair(x,-1,COLOR_BLUE) will initialize pair x as
88 default foreground on blue.
90 The other, <EM>assume</EM><STRONG>_</STRONG><EM>default</EM><STRONG>_</STRONG><EM>colors()</EM> is a refinement which
91 tells which colors to paint for color pair 0. This func-
92 tion recognizes a special color number -1, which denotes
93 the default terminal color.
95 The following are equivalent:
96 <EM>use</EM><STRONG>_</STRONG><EM>default</EM><STRONG>_</STRONG><EM>colors();</EM>
97 <EM>assume</EM><STRONG>_</STRONG><EM>default</EM><STRONG>_</STRONG><EM>colors(-1,-1);</EM>
99 These are ncurses extensions. For other curses implemen-
100 tations, color number -1 does not mean anything, just as
101 for ncurses before a successful call of <EM>use</EM><STRONG>_</STRONG><EM>default</EM><STRONG>_</STRONG><EM>col-</EM>
102 <EM>ors()</EM> or <EM>assume</EM><STRONG>_</STRONG><EM>default</EM><STRONG>_</STRONG><EM>colors()</EM>.
104 Other curses implementations do not allow an application
105 to modify color pair 0. They assume that the background
106 is COLOR_BLACK, but do not ensure that the color pair 0 is
107 painted to match the assumption. If your application does
108 not use either <EM>use</EM><STRONG>_</STRONG><EM>default</EM><STRONG>_</STRONG><EM>colors()</EM> or <EM>assume</EM><STRONG>_</STRONG><EM>default</EM><STRONG>_</STRONG><EM>col-</EM>
109 <EM>ors()</EM> ncurses will paint a white foreground (text) with
110 black background for color pair 0.
113 </PRE>
114 <H2><a name="h2-RETURN-VALUE">RETURN VALUE</a></H2><PRE>
115 These functions return the integer <STRONG>ERR</STRONG> upon failure and <STRONG>OK</STRONG>
116 on success. They will fail if either the terminal does
117 not support the <EM>orig</EM><STRONG>_</STRONG><EM>pair</EM> or <EM>orig</EM><STRONG>_</STRONG><EM>colors</EM> capability. If
118 the <EM>initialize</EM><STRONG>_</STRONG><EM>pair</EM> capability is not found, this causes
119 an error as well.
122 </PRE>
123 <H2><a name="h2-NOTES">NOTES</a></H2><PRE>
124 Associated with this extension, the <STRONG>init_pair</STRONG> function
125 accepts negative arguments to specify default foreground
126 or background colors.
128 The <EM>use</EM><STRONG>_</STRONG><EM>default</EM><STRONG>_</STRONG><EM>colors()</EM> function was added to support
129 <EM>ded</EM>. This is a full-screen application which uses curses
130 to manage only part of the screen. The bottom portion of
131 the screen, which is of adjustable size, is left uncolored
132 to display the results from shell commands. The top por-
133 tion of the screen colors filenames using a scheme like
134 the "color ls" programs. Attempting to manage the back-
135 ground color of the screen for this application would give
136 unsatisfactory results for a variety of reasons. This
137 extension was devised after noting that color xterm (and
138 similar programs) provides a background color which does
139 not necessarily correspond to any of the ANSI colors.
140 While a special terminfo entry could be constructed using
141 nine colors, there was no mechanism provided within curses
142 to account for the related <EM>orig</EM><STRONG>_</STRONG><EM>pair</EM> and <EM>back</EM><STRONG>_</STRONG><EM>color</EM><STRONG>_</STRONG><EM>erase</EM>
143 capabilities.
145 The <EM>assume</EM><STRONG>_</STRONG><EM>default</EM><STRONG>_</STRONG><EM>colors()</EM> function was added to solve a
146 different problem: support for applications which would
147 use environment variables and other configuration to
148 bypass curses' notion of the terminal's default colors,
149 setting specific values.
152 </PRE>
153 <H2><a name="h2-PORTABILITY">PORTABILITY</a></H2><PRE>
154 These routines are specific to ncurses. They were not
155 supported on Version 7, BSD or System V implementations.
156 It is recommended that any code depending on them be con-
157 ditioned using NCURSES_VERSION.
160 </PRE>
161 <H2><a name="h2-SEE-ALSO">SEE ALSO</a></H2><PRE>
162 <STRONG><A HREF="curs_color.3x.html">curs_color(3x)</A></STRONG>, <STRONG>ded(1)</STRONG>.
165 </PRE>
166 <H2><a name="h2-AUTHOR">AUTHOR</a></H2><PRE>
167 Thomas Dickey (from an analysis of the requirements for
168 color xterm for XFree86 3.1.2C, February 1996).
172 <STRONG><A HREF="default_colors.3x.html">default_colors(3x)</A></STRONG>
173 </PRE>
174 <div class="nav">
175 <ul>
176 <li><a href="#h2-NAME">NAME</a></li>
177 <li><a href="#h2-SYNOPSIS">SYNOPSIS</a></li>
178 <li><a href="#h2-DESCRIPTION">DESCRIPTION</a></li>
179 <li><a href="#h2-RETURN-VALUE">RETURN VALUE</a></li>
180 <li><a href="#h2-NOTES">NOTES</a></li>
181 <li><a href="#h2-PORTABILITY">PORTABILITY</a></li>
182 <li><a href="#h2-SEE-ALSO">SEE ALSO</a></li>
183 <li><a href="#h2-AUTHOR">AUTHOR</a></li>
184 </ul>
185 </div>
186 </BODY>
187 </HTML>