1curs_attr(3X) curs_attr(3X)
2
3
4
6 attroff, wattroff, attron, wattron, attrset, wattrset, color_set,
7 wcolor_set, standend, wstandend, standout, wstandout, attr_get,
8 wattr_get, attr_off, wattr_off, attr_on, wattr_on, attr_set, wattr_set,
9 chgat, wchgat, mvchgat, mvwchgat, PAIR_NUMBER - curses character and
10 window attribute control routines
11
13 #include <curses.h>
14 int attroff(int attrs);
15 int wattroff(WINDOW *win, int attrs);
16 int attron(int attrs);
17 int wattron(WINDOW *win, int attrs);
18 int attrset(int attrs);
19 int wattrset(WINDOW *win, int attrs);
20 int color_set(short color_pair_number, void* opts);
21 int wcolor_set(WINDOW *win, short color_pair_number,
22 void* opts);
23 int standend(void);
24 int wstandend(WINDOW *win);
25 int standout(void);
26 int wstandout(WINDOW *win);
27 int attr_get(attr_t *attrs, short *pair, void *opts);
28 int wattr_get(WINDOW *win, attr_t *attrs, short *pair,
29 void *opts);
30 int attr_off(attr_t attrs, void *opts);
31 int wattr_off(WINDOW *win, attr_t attrs, void *opts);
32 int attr_on(attr_t attrs, void *opts);
33 int wattr_on(WINDOW *win, attr_t attrs, void *opts);
34 int attr_set(attr_t attrs, short pair, void *opts);
35 int wattr_set(WINDOW *win, attr_t attrs, short pair, void *opts);
36 int chgat(int n, attr_t attr, short color,
37 const void *opts)
38 int wchgat(WINDOW *win, int n, attr_t attr,
39 short color, const void *opts)
40 int mvchgat(int y, int x, int n, attr_t attr,
41 short color, const void *opts)
42 int mvwchgat(WINDOW *win, int y, int x, int n,
43 attr_t attr, short color, const void *opts)
44
46 These routines manipulate the current attributes of the named window.
47 The current attributes of a window apply to all characters that are
48 written into the window with waddch, waddstr and wprintw. Attributes
49 are a property of the character, and move with the character through
50 any scrolling and insert/delete line/character operations. To the ex‐
51 tent possible, they are displayed as appropriate modifications to the
52 graphic rendition of characters put on the screen.
53
54 The routine attrset sets the current attributes of the given window to
55 attrs. The routine attroff turns off the named attributes without
56 turning any other attributes on or off. The routine attron turns on
57 the named attributes without affecting any others. The routine stand‐
58 out is the same as attron(A_STANDOUT). The routine standend is the
59 same as attrset(A_NORMAL) or attrset(0), that is, it turns off all at‐
60 tributes.
61
62 The attrset and related routines do not affect the attributes used when
63 erasing portions of the window. See curs_bkgd(3X) for functions which
64 modify the attributes used for erasing and clearing.
65
66 The routine color_set sets the current color of the given window to the
67 foreground/background combination described by the color_pair_number.
68 The parameter opts is reserved for future use, applications must supply
69 a null pointer.
70
71 The routine wattr_get returns the current attribute and color pair for
72 the given window; attr_get returns the current attribute and color pair
73 for stdscr. The remaining attr_* functions operate exactly like the
74 corresponding attr* functions, except that they take arguments of type
75 attr_t rather than int.
76
77 The routine chgat changes the attributes of a given number of charac‐
78 ters starting at the current cursor location of stdscr. It does not
79 update the cursor and does not perform wrapping. A character count of
80 -1 or greater than the remaining window width means to change at‐
81 tributes all the way to the end of the current line. The wchgat func‐
82 tion generalizes this to any window; the mvwchgat function does a cur‐
83 sor move before acting. In these functions, the color argument is a
84 color-pair index (as in the first argument of init_pair, see curs_col‐
85 or(3X)). The opts argument is not presently used, but is reserved for
86 the future (leave it NULL).
87
88 Attributes
89 The following video attributes, defined in <curses.h>, can be passed to
90 the routines attron, attroff, and attrset, or OR'd with the characters
91 passed to addch.
92
93 A_NORMAL Normal display (no highlight)
94 A_STANDOUT Best highlighting mode of the terminal.
95 A_UNDERLINE Underlining
96 A_REVERSE Reverse video
97 A_BLINK Blinking
98 A_DIM Half bright
99 A_BOLD Extra bright or bold
100 A_PROTECT Protected mode
101 A_INVIS Invisible or blank mode
102 A_ALTCHARSET Alternate character set
103 A_CHARTEXT Bit-mask to extract a character
104 COLOR_PAIR(n) Color-pair number n
105
106 The following macro is the reverse of COLOR_PAIR(n):
107
108 PAIR_NUMBER(attrs) Returns the pair number associated
109 with the COLOR_PAIR(n) attribute.
110
111 The return values of many of these routines are not meaningful (they
112 are implemented as macro-expanded assignments and simply return their
113 argument). The SVr4 manual page claims (falsely) that these routines
114 always return 1.
115
117 Note that attroff, wattroff, attron, wattron, attrset, wattrset,
118 standend and standout may be macros.
119
120 COLOR_PAIR values can only be OR'd with attributes if the pair number
121 is less than 256. The alternate functions such as color_set can pass a
122 color pair value directly. However, ncurses ABI 4 and 5 simply OR this
123 value within the alternate functions. You must use ncurses ABI 6 to
124 support more than 256 color pairs.
125
127 These functions are supported in the XSI Curses standard, Issue 4. The
128 standard defined the dedicated type for highlights, attr_t, which is
129 not defined in SVr4 curses. The functions taking attr_t arguments are
130 not supported under SVr4.
131
132 The XSI Curses standard states that whether the traditional functions
133 attron/attroff/attrset can manipulate attributes other than A_BLINK,
134 A_BOLD, A_DIM, A_REVERSE, A_STANDOUT, or A_UNDERLINE is "unspecified".
135 Under this implementation as well as SVr4 curses, these functions cor‐
136 rectly manipulate all other highlights (specifically, A_ALTCHARSET,
137 A_PROTECT, and A_INVIS).
138
139 XSI Curses added the new entry points, attr_get, attr_on, attr_off, at‐
140 tr_set, wattr_on, wattr_off, wattr_get, wattr_set. These are intended
141 to work with a new series of highlight macros prefixed with WA_.
142
143 Older versions of this library did not force an update of the screen
144 when changing the attributes. Use touchwin to force the screen to
145 match the updated attributes.
146
147 WA_NORMAL Normal display (no highlight)
148 WA_STANDOUT Best highlighting mode of the terminal.
149 WA_UNDERLINE Underlining
150 WA_REVERSE Reverse video
151 WA_BLINK Blinking
152 WA_DIM Half bright
153 WA_BOLD Extra bright or bold
154 WA_ALTCHARSET Alternate character set
155
156 The XSI curses standard specifies that each pair of corresponding A_
157 and WA_-using functions operates on the same current-highlight informa‐
158 tion.
159
160 The XSI standard extended conformance level adds new highlights A_HORI‐
161 ZONTAL, A_LEFT, A_LOW, A_RIGHT, A_TOP, A_VERTICAL (and corresponding
162 WA_ macros for each) which this implementation does not yet support.
163
165 All routines return the integer OK on success, or ERR on failure.
166
167 X/Open does not define any error conditions.
168
169 This implementation returns an error if the window pointer is null.
170 The wcolor_set function returns an error if the color pair parameter is
171 outside the range 0..COLOR_PAIRS-1. This implementation also provides
172 getattrs for compatibility with older versions of curses.
173
175 curses(3X), curs_addch(3X), curs_addstr(3X), curs_bkgd(3X),
176 curs_printw(3X)
177
178
179
180 curs_attr(3X)