]> ncurses.scripts.mit.edu Git - ncurses.git/blob - doc/html/man/default_colors.3x.html
ncurses 5.9 - patch 20150214
[ncurses.git] / doc / html / man / default_colors.3x.html
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>default_colors 3x</H1>
43 <HR>
44 <PRE>
45 <STRONG><A HREF="default_colors.3x.html">default_colors(3x)</A></STRONG>                                   <STRONG><A HREF="default_colors.3x.html">default_colors(3x)</A></STRONG>
46
47
48
49
50 </PRE>
51 <H2><a name="h2-NAME">NAME</a></H2><PRE>
52        <STRONG>use_default_colors</STRONG>, <STRONG>assume_default_colors</STRONG> - use terminal's
53        default colors
54
55
56 </PRE>
57 <H2><a name="h2-SYNOPSIS">SYNOPSIS</a></H2><PRE>
58        <STRONG>#include</STRONG> <STRONG>&lt;curses.h&gt;</STRONG>
59
60        <STRONG>int</STRONG> <STRONG>use_default_colors(void);</STRONG>
61        <STRONG>int</STRONG> <STRONG>assume_default_colors(int</STRONG> <STRONG>fg,</STRONG> <STRONG>int</STRONG> <STRONG>bg);</STRONG>
62
63
64 </PRE>
65 <H2><a name="h2-DESCRIPTION">DESCRIPTION</a></H2><PRE>
66        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-
67        tions are extensions to the curses library.  They are used
68        with terminals that support ISO 6429 color, or equivalent.
69        These terminals allow the application to reset color to an
70        unspecified default value (e.g., with SGR 39 or SGR 49).
71
72        Applications that paint  a  colored  background  over  the
73        whole  screen  do not take advantage of SGR 39 and SGR 49.
74        Some applications are designed to work  with  the  default
75        background,  using  colors  only  for  text.  For example,
76        there are several implementations of the <STRONG>ls</STRONG> program  which
77        use  colors to denote different file types or permissions.
78        These "color ls" programs do not  necessarily  modify  the
79        background  color, typically using only the <EM>setaf</EM> terminfo
80        capability  to  set  the  foreground  color.   Full-screen
81        applications  that  use default colors can achieve similar
82        visual effects.
83
84        The first function, <EM>use</EM><STRONG>_</STRONG><EM>default</EM><STRONG>_</STRONG><EM>colors()</EM> tells the  curses
85        library  to  assign terminal default foreground/background
86        colors to color number  -1.  So  init_pair(x,COLOR_RED,-1)
87        will  initialize  pair  x as red on default background and
88        init_pair(x,-1,COLOR_BLUE)  will  initialize  pair  x   as
89        default foreground on blue.
90
91        The  other,  <EM>assume</EM><STRONG>_</STRONG><EM>default</EM><STRONG>_</STRONG><EM>colors()</EM> is a refinement which
92        tells which colors to paint for color pair 0.  This  func-
93        tion  recognizes  a special color number -1, which denotes
94        the default terminal color.
95
96        The following are equivalent:
97               <EM>use</EM><STRONG>_</STRONG><EM>default</EM><STRONG>_</STRONG><EM>colors();</EM>
98               <EM>assume</EM><STRONG>_</STRONG><EM>default</EM><STRONG>_</STRONG><EM>colors(-1,-1);</EM>
99
100        These are ncurses extensions.  For other curses  implemen-
101        tations,  color  number -1 does not mean anything, just as
102        for ncurses before a successful call  of  <EM>use</EM><STRONG>_</STRONG><EM>default</EM><STRONG>_</STRONG><EM>col-</EM>
103        <EM>ors()</EM> or <EM>assume</EM><STRONG>_</STRONG><EM>default</EM><STRONG>_</STRONG><EM>colors()</EM>.
104
105        Other  curses  implementations do not allow an application
106        to modify color pair 0.  They assume that  the  background
107        is COLOR_BLACK, but do not ensure that the color pair 0 is
108        painted to match the assumption.  If your application does
109        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>
110        <EM>ors()</EM> ncurses will paint a white  foreground  (text)  with
111        black background for color pair 0.
112
113
114 </PRE>
115 <H2><a name="h2-RETURN-VALUE">RETURN VALUE</a></H2><PRE>
116        These functions return the integer <STRONG>ERR</STRONG> upon failure and <STRONG>OK</STRONG>
117        on success.  They will fail if either  the  terminal  does
118        not  support  the <EM>orig</EM><STRONG>_</STRONG><EM>pair</EM> or <EM>orig</EM><STRONG>_</STRONG><EM>colors</EM> capability.  If
119        the <EM>initialize</EM><STRONG>_</STRONG><EM>pair</EM> capability is not found,  this  causes
120        an error as well.
121
122
123 </PRE>
124 <H2><a name="h2-NOTES">NOTES</a></H2><PRE>
125        Associated  with  this  extension,  the <STRONG>init_pair</STRONG> function
126        accepts negative arguments to specify  default  foreground
127        or background colors.
128
129        The  <EM>use</EM><STRONG>_</STRONG><EM>default</EM><STRONG>_</STRONG><EM>colors()</EM>  function  was  added to support
130        <EM>ded</EM>.  This is a full-screen application which uses  curses
131        to  manage only part of the screen.  The bottom portion of
132        the screen, which is of adjustable size, is left uncolored
133        to  display the results from shell commands.  The top por-
134        tion of the screen colors filenames using  a  scheme  like
135        the  "color  ls" programs.  Attempting to manage the back-
136        ground color of the screen for this application would give
137        unsatisfactory  results  for  a  variety of reasons.  This
138        extension was devised after noting that color  xterm  (and
139        similar  programs)  provides a background color which does
140        not necessarily correspond to  any  of  the  ANSI  colors.
141        While  a special terminfo entry could be constructed using
142        nine colors, there was no mechanism provided within curses
143        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>
144        capabilities.
145
146        The <EM>assume</EM><STRONG>_</STRONG><EM>default</EM><STRONG>_</STRONG><EM>colors()</EM> function was added to solve  a
147        different  problem:  support  for applications which would
148        use  environment  variables  and  other  configuration  to
149        bypass  curses'  notion  of the terminal's default colors,
150        setting specific values.
151
152
153 </PRE>
154 <H2><a name="h2-PORTABILITY">PORTABILITY</a></H2><PRE>
155        These routines are specific to  ncurses.   They  were  not
156        supported  on  Version 7, BSD or System V implementations.
157        It is recommended that any code depending on them be  con-
158        ditioned using NCURSES_VERSION.
159
160
161 </PRE>
162 <H2><a name="h2-SEE-ALSO">SEE ALSO</a></H2><PRE>
163        <STRONG><A HREF="curs_color.3x.html">curs_color(3x)</A></STRONG>, <STRONG>ded(1)</STRONG>.
164
165
166 </PRE>
167 <H2><a name="h2-AUTHOR">AUTHOR</a></H2><PRE>
168        Thomas  Dickey  (from  an analysis of the requirements for
169        color xterm for XFree86 3.1.2C, February 1996).
170
171
172
173                                                      <STRONG><A HREF="default_colors.3x.html">default_colors(3x)</A></STRONG>
174 </PRE>
175 <div class="nav">
176 <ul>
177 <li><a href="#h2-NAME">NAME</a></li>
178 <li><a href="#h2-SYNOPSIS">SYNOPSIS</a></li>
179 <li><a href="#h2-DESCRIPTION">DESCRIPTION</a></li>
180 <li><a href="#h2-RETURN-VALUE">RETURN VALUE</a></li>
181 <li><a href="#h2-NOTES">NOTES</a></li>
182 <li><a href="#h2-PORTABILITY">PORTABILITY</a></li>
183 <li><a href="#h2-SEE-ALSO">SEE ALSO</a></li>
184 <li><a href="#h2-AUTHOR">AUTHOR</a></li>
185 </ul>
186 </div>
187 </BODY>
188 </HTML>