2 ****************************************************************************
3 * Copyright (c) 1998-2011,2016 Free Software Foundation, Inc. *
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: *
13 * The above copyright notice and this permission notice shall be included *
14 * in all copies or substantial portions of the Software. *
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. *
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 *
28 ****************************************************************************
29 * Author: Thomas E. Dickey 1997,1999,2000,2005
30 * @Id: default_colors.3x,v 1.25 2016/10/15 17:16:48 tom Exp @
32 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
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">
42 <H1 class="no-header">default_colors 3x</H1>
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><H2><a name="h2-NAME">NAME</a></H2><PRE>
50 <STRONG>use_default_colors</STRONG>, <STRONG>assume_default_colors</STRONG> - use terminal's
54 </PRE><H2><a name="h2-SYNOPSIS">SYNOPSIS</a></H2><PRE>
55 <STRONG>#include</STRONG> <STRONG><curses.h></STRONG>
57 <STRONG>int</STRONG> <STRONG>use_default_colors(void);</STRONG>
58 <STRONG>int</STRONG> <STRONG>assume_default_colors(int</STRONG> <STRONG>fg,</STRONG> <STRONG>int</STRONG> <STRONG>bg);</STRONG>
61 </PRE><H2><a name="h2-DESCRIPTION">DESCRIPTION</a></H2><PRE>
62 The <STRONG>use_default_colors</STRONG> and <STRONG>assume_default_colors</STRONG> functions
63 are extensions to the curses library. They are used with
64 terminals that support ISO 6429 color, or equivalent.
65 These terminals allow the application to reset color to an
66 unspecified default value (e.g., with SGR 39 or SGR 49).
68 Applications that paint a colored background over the
69 whole screen do not take advantage of SGR 39 and SGR 49.
70 Some applications are designed to work with the default
71 background, using colors only for text. For example,
72 there are several implementations of the <STRONG>ls</STRONG> program which
73 use colors to denote different file types or permissions.
74 These "color ls" programs do not necessarily modify the
75 background color, typically using only the <STRONG>setaf</STRONG> terminfo
76 capability to set the foreground color. Full-screen
77 applications that use default colors can achieve similar
80 The first function, <STRONG>use_default_colors</STRONG> tells the curses
81 library to assign terminal default foreground/background
82 colors to color number -1. So init_pair(x,COLOR_RED,-1)
83 will initialize pair x as red on default background and
84 init_pair(x,-1,COLOR_BLUE) will initialize pair x as
85 default foreground on blue.
87 The other, <STRONG>assume_default_colors</STRONG> is a refinement which
88 tells which colors to paint for color pair 0. This func-
89 tion recognizes a special color number -1, which denotes
90 the default terminal color.
92 The following are equivalent:
93 <EM>use</EM><STRONG>_</STRONG><EM>default</EM><STRONG>_</STRONG><EM>colors();</EM>
94 <EM>assume</EM><STRONG>_</STRONG><EM>default</EM><STRONG>_</STRONG><EM>colors(-1,-1);</EM>
96 These are ncurses extensions. For other curses implemen-
97 tations, color number -1 does not mean anything, just as
98 for ncurses before a successful call of <STRONG>use_default_colors</STRONG>
99 or <STRONG>assume_default_colors</STRONG>.
101 Other curses implementations do not allow an application
102 to modify color pair 0. They assume that the background
103 is COLOR_BLACK, but do not ensure that the color pair 0 is
104 painted to match the assumption. If your application does
105 not use either <STRONG>use_default_colors</STRONG> or <STRONG>assume_default_colors</STRONG>
106 ncurses will paint a white foreground (text) with black
107 background for color pair 0.
110 </PRE><H2><a name="h2-RETURN-VALUE">RETURN VALUE</a></H2><PRE>
111 These functions return the integer <STRONG>ERR</STRONG> upon failure and <STRONG>OK</STRONG>
112 on success. They will fail if either the terminal does
113 not support the <STRONG>orig_pair</STRONG> or <STRONG>orig_colors</STRONG> capability. If
114 the <STRONG>initialize_pair</STRONG> capability is not found, this causes
118 </PRE><H2><a name="h2-NOTES">NOTES</a></H2><PRE>
119 Associated with this extension, the <STRONG>init_pair</STRONG> function
120 accepts negative arguments to specify default foreground
121 or background colors.
123 The <STRONG>use_default_colors</STRONG> function was added to support <EM>ded</EM>.
124 This is a full-screen application which uses curses to
125 manage only part of the screen. The bottom portion of the
126 screen, which is of adjustable size, is left uncolored to
127 display the results from shell commands. The top portion
128 of the screen colors filenames using a scheme like the
129 "color ls" programs. Attempting to manage the background
130 color of the screen for this application would give unsat-
131 isfactory results for a variety of reasons. This exten-
132 sion was devised after noting that color xterm (and simi-
133 lar programs) provides a background color which does not
134 necessarily correspond to any of the ANSI colors. While a
135 special terminfo entry could be constructed using nine
136 colors, there was no mechanism provided within curses to
137 account for the related <STRONG>orig_pair</STRONG> and <STRONG>back_color_erase</STRONG>
140 The <STRONG>assume_default_colors</STRONG> function was added to solve a
141 different problem: support for applications which would
142 use environment variables and other configuration to
143 bypass curses' notion of the terminal's default colors,
144 setting specific values.
147 </PRE><H2><a name="h2-PORTABILITY">PORTABILITY</a></H2><PRE>
148 These routines are specific to ncurses. They were not
149 supported on Version 7, BSD or System V implementations.
150 It is recommended that any code depending on them be con-
151 ditioned using NCURSES_VERSION.
154 </PRE><H2><a name="h2-SEE-ALSO">SEE ALSO</a></H2><PRE>
155 <STRONG><A HREF="curs_color.3x.html">curs_color(3x)</A></STRONG>, <STRONG>ded(1)</STRONG>.
158 </PRE><H2><a name="h2-AUTHOR">AUTHOR</a></H2><PRE>
159 Thomas Dickey (from an analysis of the requirements for
160 color xterm for XFree86 3.1.2C, February 1996).
164 <STRONG><A HREF="default_colors.3x.html">default_colors(3x)</A></STRONG>
168 <li><a href="#h2-NAME">NAME</a></li>
169 <li><a href="#h2-SYNOPSIS">SYNOPSIS</a></li>
170 <li><a href="#h2-DESCRIPTION">DESCRIPTION</a></li>
171 <li><a href="#h2-RETURN-VALUE">RETURN VALUE</a></li>
172 <li><a href="#h2-NOTES">NOTES</a></li>
173 <li><a href="#h2-PORTABILITY">PORTABILITY</a></li>
174 <li><a href="#h2-SEE-ALSO">SEE ALSO</a></li>
175 <li><a href="#h2-AUTHOR">AUTHOR</a></li>