summaryrefslogtreecommitdiffstats
path: root/lib/terminal-colors.d.5
blob: e0bec23fcb757a31493bd1f32a0a6e579f2534f4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
.\" terminal-colors.d.5 --
.\" Copyright 2014 Ondrej Oprala <ooprala@redhat.com>
.\" Copyright (C) 2014 Karel Zak <kzak@redhat.com>
.\" Copyright 2014 Red Hat, Inc.
.\" May be distributed under the GNU General Public License
.TH "TERMINAL_COLORS.D" "5" "January 2014" "util-linux" "terminal-colors.d"
.SH "NAME"
terminal-colors.d \- Configure output colorization for various utilities
.SH "SYNOPSIS"
/etc/terminal-colors\&.d/[[\fIname\fR][@\fIterm\fR]\&.][\fItype\fR]
.SH "DESCRIPTION"
Files in this directory determine the default behavior for utilities
when coloring output.

The
.I name
is a utility name.  The name is optional and when none is specified then the
file is used for all unspecified utilities.

The
.I term
is a terminal identifier (the TERM environment variable).
The terminal identifier is optional and when none is specified then the file
is used for all unspecified terminals.

The
.I type
is a file type.  Supported file types are:
.TP
.B disable
Turns off output colorization for all compatible utilities.
.TP
.B enable
Turns on output colorization; any matching
.B disable
files are ignored.
.TP
.B scheme
Specifies colors used for output.  The file format may be specific to the utility,
the default format is described below.
.PP
If there are more files that match for a utility, then the file with the more
specific filename wins.  For example, the filename "@xterm.scheme" has less
priority than "dmesg@xterm.scheme".  The lowest priority are those files without a
utility name and terminal identifier (e.g. "disable").

The user-specific
.I $XDG_CONFIG_HOME/terminal-colors.d
or
.I $HOME/.config/terminal-colors.d
overrides the global setting.

.SH EXAMPLES
Disable colors for all compatible utilities:
.RS
.br
.B "touch /etc/terminal-colors.d/disable"
.br
.RE

Disable colors for all compatible utils on a vt100 terminal:
.RS
.br
.B "touch /etc/terminal-colors.d/@vt100.disable"
.br
.RE

Disable colors for all compatible utils except dmesg(1):
.RS
.br
.B "touch /etc/terminal-colors.d/disable"
.sp
.B "touch /etc/terminal-colors.d/dmesg.enable"
.br
.RE

.SH DEFAULT SCHEME FILES FORMAT
The following statement is recognized:

.RS
.br
.B "name color-sequence"
.br
.RE

The
.B name
is a logical name of color sequence (for example "error").  The names are
specific to the utilities.  For more details always see the COLORS section
in the man page for the utility.

The
.B color-sequence
is a color name, ASCII color sequences or escape sequences.

.SS Color names
black, blink, blue, bold, brown, cyan, darkgray, gray, green, halfbright,
lightblue, lightcyan, lightgray, lightgreen, lightmagenta, lightred, magenta,
red, reset, reverse, and yellow.

.SS ANSI color sequences
The color sequences are composed of sequences of numbers
separated by semicolons.  The most common codes are:
.sp
.RS
.TS
l l.
 0	to restore default color
 1	for brighter colors
 4	for underlined text
 5	for flashing text
30	for black foreground
31	for red foreground
32	for green foreground
33	for yellow (or brown) foreground
34	for blue foreground
35	for purple foreground
36	for cyan foreground
37	for white (or gray) foreground
40	for black background
41	for red background
42	for green background
43	for yellow (or brown) background
44	for blue background
45	for purple background
46	for cyan background
47	for white (or gray) background
.TE
.RE
.SS Escape sequences
To specify control or blank characters in the color sequences,
C-style \e-escaped notation can be used:
.sp
.RS
.TS
lb l.
\ea	Bell (ASCII 7)
\eb	Backspace (ASCII 8)
\ee	Escape (ASCII 27)
\ef	Form feed (ASCII 12)
\en	Newline (ASCII 10)
\er	Carriage Return (ASCII 13)
\et	Tab (ASCII 9)
\ev	Vertical Tab (ASCII 11)
\e?	Delete (ASCII 127)
\e_	Space
\e\e	Backslash (\e)
\e^	Caret (^)
\e#	Hash mark (#)
.TE
.RE
.sp
Please note that escapes are necessary to enter a space, backslash,
caret, or any control character anywhere in the string, as well as a
hash mark as the first character.

For example, to use a red background for alert messages in the output of
.BR dmesg (1),
use:

.RS
.br
.B "echo 'alert 37;41' >> /etc/terminal-colors.d/dmesg.scheme"
.br
.RE

.SS Comments
Lines where the first non-blank character is a # (hash) are ignored.
Any other use of the hash character is not interpreted as introducing
a comment.

.SH FILES
.I $XDG_CONFIG_HOME/terminal-colors.d
.br
.I $HOME/.config/terminal-colors.d
.br
.I /etc/terminal-colors.d

.SH ENVIRONMENT
.IP TERMINAL_COLORS_DEBUG=all
enables debug output.

.SH COMPATIBILITY
The terminal-colors.d functionality is currently supported by all util-linux
utilities which provides colorized output.  For more details always see the
COLORS section in the man page for the utility.

.SH AVAILABILITY
terminal-colors.d is part of the util-linux package and is available from
.UR https://\:www.kernel.org\:/pub\:/linux\:/utils\:/util-linux/
Linux Kernel Archive
.UE .