xref: /netbsd/lib/libcurses/curses_attributes.3 (revision c4a72b64)
1.\"	$NetBSD: curses_attributes.3,v 1.2 2002/10/21 14:17:54 wiz Exp $
2.\" Copyright (c) 2002 The NetBSD Foundation, Inc.
3.\" All rights reserved.
4.\"
5.\" This code is derived from software contributed to The NetBSD Foundation
6.\" by Julian Coleman.
7.\"
8.\" Redistribution and use in source and binary forms, with or without
9.\" modification, are permitted provided that the following conditions
10.\" are met:
11.\" 1. Redistributions of source code must retain the above copyright
12.\"    notice, this list of conditions and the following disclaimer.
13.\" 2. Redistributions in binary form must reproduce the above copyright
14.\"    notice, this list of conditions and the following disclaimer in the
15.\"    documentation and/or other materials provided with the distribution.
16.\" 3. Neither the name of The NetBSD Foundation nor the names of its
17.\"    contributors may be used to endorse or promote products derived
18.\"    from this software without specific prior written permission.
19.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29.\" POSSIBILITY OF SUCH DAMAGE.
30.\"
31.Dd October 13, 2002
32.Dt CURSES_ATTRIBUTES 3
33.Os
34.Sh NAME
35.Nm curses_attributes ,
36.Nm attron ,
37.Nm attroff ,
38.Nm attrset ,
39.Nm wattron ,
40.Nm wattroff ,
41.Nm wattrset ,
42.Nm getattrs
43.Nd curses general attribute manipulation routines
44.Sh LIBRARY
45.Lb libcurses
46.Sh SYNOPSIS
47.Fd #include \*[Lt]curses.h\*[Gt]
48.Ft int
49.Fn attron int
50.Ft int
51.Fn attroff int
52.Ft int
53.Fn attrset int
54.Ft int
55.Fn wattron int
56.Ft int
57.Fn wattroff int
58.Ft int
59.Fn wattrset int
60.Ft chtype
61.Fn getattrs "WINDOW *win"
62.Sh DESCRIPTION
63These functions manipulate attributes on
64.Dv stdscr
65or on the specified window.
66The attributes that can be manipulated are:
67.Pp
68.Bl -tag -width "A_ALTCHARSET" -compact -offset indent
69.It A_NORMAL
70no special attributes are applied
71.It A_STANDOUT
72characters are displayed in standout mode
73.It A_UNDERLINE
74characters are displayed underlined
75.It A_REVERSE
76characters are displayed in inverse video
77.It A_BLINK
78characters blink
79.It A_DIM
80characters are displayed at a lower intensity
81.It A_BOLD
82characters are displayed at a higher intensity
83.It A_BLANK
84characters are added as blanks
85.It A_PROTECT
86characters are protected from modification
87.It A_ALTCHARSET
88characters are displayed using the alternate character set (ACS)
89.El
90along with color.
91.Pp
92The function
93.Fn attron
94turns on the attributes specified in
95.Fa attr
96on
97.Dv stdscr .
98.Pp
99The function
100.Fn attroff
101turns off the attributes specified in
102.Fa attr
103on
104.Dv stdscr .
105.Pp
106The function
107.Fn attrset
108sets the attributes of
109.Dv stdscr
110to those specified in
111.Fa attr ,
112turning off any others.
113To turn off all the attributes (including color and alternate character set),
114use
115.Fn attrset A_NORMAL .
116.Pp
117Multiple attributes can be manipulated by combining the attributes
118using a logical
119.Em OR .
120For example,
121.Fn attron "A_REVERSE | A_BOLD"
122will turn on both inverse video and higher intensity.
123.Pp
124The functions
125.Fn wattron ,
126.Fn wattroff
127and
128.Fn wattrset
129are equivalent to
130.Fn attron ,
131.Fn attroff
132and
133.Fn attrset ,
134respectively, excepting that the character is added to the window specified by
135.Fa win .
136.Pp
137The function
138.Fn getattrs
139returns the attributes that are currently applied to window specified by
140.Fa win .
141.Sh RETURN VALUES
142These functions return OK on success and ERR on failure.
143.Sh SEE ALSO
144.Xr curses_addch 3 ,
145.Xr curses_addstr 3 ,
146.Xr curses_background 3 ,
147.Xr curses_color 3 ,
148.Xr curses_insertch 3 ,
149.Xr curses_standout 3 ,
150.Xr curses_underscore 3
151.Sh STANDARDS
152The
153.Nx
154Curses library complies with the X/Open Curses specification, part of the
155Single Unix Specification.
156.Sh HISTORY
157These functions first appeared in
158.Nx 1.5 .
159.Sh BUGS
160Some terminals do not support characters with both color and other attributes
161set.
162In this case, the other attribute is displayed instead of the color attribute.
163