]> git.ipfire.org Git - thirdparty/util-linux.git/blame - lib/terminal-colors.d.5
Manual pages: order NOTES / HISTORY / BUGS / EXAMPLE consistently
[thirdparty/util-linux.git] / lib / terminal-colors.d.5
CommitLineData
60ec67ff
KZ
1.\" terminal-colors.d.5 --
2.\" Copyright 2014 Ondrej Oprala <ooprala@redhat.com>
3.\" Copyright (C) 2014 Karel Zak <kzak@redhat.com>
4.\" Copyright 2014 Red Hat, Inc.
5.\" May be distributed under the GNU General Public License
2574500f 6.TH "TERMINAL_COLORS.D" "5" "January 2014" "util-linux" "terminal-colors.d"
5a829806 7.SH NAME
60ec67ff 8terminal-colors.d \- Configure output colorization for various utilities
5a829806 9.SH SYNOPSIS
1f94a78c 10/etc/terminal-colors\&.d/[[\fIname\fR][@\fIterm\fR]\&.][\fItype\fR]
5a829806 11.SH DESCRIPTION
ee312c65 12Files in this directory determine the default behavior for utilities
bb3c59dc
KZ
13when coloring output.
14
15The
1f94a78c
BS
16.I name
17is a utility name. The name is optional and when none is specified then the
bb3c59dc 18file is used for all unspecified utilities.
60ec67ff 19
bb3c59dc 20The
1f94a78c 21.I term
bb3c59dc 22is a terminal identifier (the TERM environment variable).
1f94a78c 23The terminal identifier is optional and when none is specified then the file
bb3c59dc
KZ
24is used for all unspecified terminals.
25
26The
1f94a78c
BS
27.I type
28is a file type. Supported file types are:
329b0ee7 29.TP
60ec67ff 30.B disable
329b0ee7
KZ
31Turns off output colorization for all compatible utilities.
32.TP
bb3c59dc 33.B enable
1f94a78c 34Turns on output colorization; any matching
329b0ee7
KZ
35.B disable
36files are ignored.
bb3c59dc
KZ
37.TP
38.B scheme
1f94a78c 39Specifies colors used for output. The file format may be specific to the utility,
bb3c59dc
KZ
40the default format is described below.
41.PP
1f94a78c
BS
42If there are more files that match for a utility, then the file with the more
43specific filename wins. For example, the filename "@xterm.scheme" has less
44priority than "dmesg@xterm.scheme". The lowest priority are those files without a
eb024893 45utility name and terminal identifier (e.g., "disable").
bb3c59dc 46
1f94a78c
BS
47The user-specific
48.I $XDG_CONFIG_HOME/terminal-colors.d
9e147794 49or
1f94a78c 50.I $HOME/.config/terminal-colors.d
9e147794
KZ
51overrides the global setting.
52
bb3c59dc
KZ
53.SH DEFAULT SCHEME FILES FORMAT
54The following statement is recognized:
55
56.RS
57.br
1f94a78c 58.B "name color-sequence"
bb3c59dc
KZ
59.br
60.RE
61
62The
63.B name
1f94a78c
BS
64is a logical name of color sequence (for example "error"). The names are
65specific to the utilities. For more details always see the COLORS section
bb3c59dc
KZ
66in the man page for the utility.
67
68The
69.B color-sequence
70is a color name, ASCII color sequences or escape sequences.
71
72.SS Color names
4683cf36
KZ
73black, blink, blue, bold, brown, cyan, darkgray, gray, green, halfbright,
74lightblue, lightcyan, lightgray, lightgreen, lightmagenta, lightred, magenta,
75red, reset, reverse, and yellow.
76
bb3c59dc
KZ
77.SS ANSI color sequences
78The color sequences are composed of sequences of numbers
1f94a78c 79separated by semicolons. The most common codes are:
bb3c59dc
KZ
80.sp
81.RS
82.TS
83l l.
84 0 to restore default color
85 1 for brighter colors
86 4 for underlined text
87 5 for flashing text
8830 for black foreground
8931 for red foreground
9032 for green foreground
9133 for yellow (or brown) foreground
9234 for blue foreground
9335 for purple foreground
9436 for cyan foreground
9537 for white (or gray) foreground
9640 for black background
9741 for red background
9842 for green background
9943 for yellow (or brown) background
10044 for blue background
10145 for purple background
10246 for cyan background
10347 for white (or gray) background
104.TE
105.RE
106.SS Escape sequences
1f94a78c 107To specify control or blank characters in the color sequences,
bb3c59dc
KZ
108C-style \e-escaped notation can be used:
109.sp
110.RS
111.TS
112lb l.
113\ea Bell (ASCII 7)
114\eb Backspace (ASCII 8)
115\ee Escape (ASCII 27)
116\ef Form feed (ASCII 12)
117\en Newline (ASCII 10)
118\er Carriage Return (ASCII 13)
119\et Tab (ASCII 9)
120\ev Vertical Tab (ASCII 11)
121\e? Delete (ASCII 127)
122\e_ Space
123\e\e Backslash (\e)
124\e^ Caret (^)
125\e# Hash mark (#)
126.TE
127.RE
128.sp
129Please note that escapes are necessary to enter a space, backslash,
130caret, or any control character anywhere in the string, as well as a
131hash mark as the first character.
132
1f94a78c
BS
133For example, to use a red background for alert messages in the output of
134.BR dmesg (1),
135use:
bb3c59dc
KZ
136
137.RS
138.br
1f94a78c 139.B "echo 'alert 37;41' >> /etc/terminal-colors.d/dmesg.scheme"
bb3c59dc
KZ
140.br
141.RE
142
4a465567 143.SS Comments
61e729bd
BS
144Lines where the first non-blank character is a # (hash) are ignored.
145Any other use of the hash character is not interpreted as introducing
146a comment.
4a465567 147
9e147794 148.SH FILES
46f057ed 149.I $XDG_CONFIG_HOME/terminal-colors.d
9e147794 150.br
46f057ed 151.I $HOME/.config/terminal-colors.d
9e147794 152.br
46f057ed 153.I /etc/terminal-colors.d
329b0ee7 154
b73cc390 155.SH ENVIRONMENT
68e422ec
KZ
156.IP TERMINAL_COLORS_DEBUG=all
157enables debug output.
b73cc390 158
67e63c12
MK
159.SH EXAMPLE
160Disable colors for all compatible utilities:
161.RS
162.br
163.B "touch /etc/terminal-colors.d/disable"
164.br
165.RE
166
167Disable colors for all compatible utils on a vt100 terminal:
168.RS
169.br
170.B "touch /etc/terminal-colors.d/@vt100.disable"
171.br
172.RE
173
174Disable colors for all compatible utils except dmesg(1):
175.RS
176.br
177.B "touch /etc/terminal-colors.d/disable"
178.sp
179.B "touch /etc/terminal-colors.d/dmesg.enable"
180.br
181.RE
182
329b0ee7 183.SH COMPATIBILITY
2574500f
BIG
184The terminal-colors.d functionality is currently supported by all util-linux
185utilities which provides colorized output. For more details always see the
329b0ee7
KZ
186COLORS section in the man page for the utility.
187
60ec67ff
KZ
188.SH AVAILABILITY
189terminal-colors.d is part of the util-linux package and is available from
d673b74e 190.UR https://\:www.kernel.org\:/pub\:/linux\:/utils\:/util-linux/
60ec67ff
KZ
191Linux Kernel Archive
192.UE .