1TERMINAL-COLORS.D(5) File formats TERMINAL-COLORS.D(5)
2
3
4
6 terminal-colors.d - configure output colorization for various utilities
7
9 /etc/terminal-colors.d/[[name][@term].][type]
10
12 Files in this directory determine the default behavior for utilities
13 when coloring output.
14
15 The name is a utility name. The name is optional and when none is
16 specified then the file is used for all unspecified utilities.
17
18 The term is a terminal identifier (the TERM environment variable). The
19 terminal identifier is optional and when none is specified then the
20 file is used for all unspecified terminals.
21
22 The type is a file type. Supported file types are:
23
24 disable
25 Turns off output colorization for all compatible utilities.
26
27 enable
28 Turns on output colorization; any matching disable files are
29 ignored.
30
31 scheme
32 Specifies colors used for output. The file format may be specific
33 to the utility, the default format is described below.
34
35 If there are more files that match for a utility, then the file with
36 the more specific filename wins. For example, the filename
37 "@xterm.scheme" has less priority than "dmesg@xterm.scheme". The lowest
38 priority are those files without a utility name and terminal identifier
39 (e.g., "disable").
40
41 The user-specific $XDG_CONFIG_HOME/terminal-colors.d or
42 $HOME/.config/terminal-colors.d overrides the global setting.
43
45 The following statement is recognized:
46
47 name color-sequence
48
49 The name is a logical name of color sequence (for example "error"). The
50 names are specific to the utilities. For more details always see the
51 COLORS section in the man page for the utility.
52
53 The color-sequence is a color name, ASCII color sequences or escape
54 sequences.
55
56 Color names
57 black, blink, blue, bold, brown, cyan, darkgray, gray, green,
58 halfbright, lightblue, lightcyan, lightgray, lightgreen, lightmagenta,
59 lightred, magenta, red, reset, reverse, and yellow.
60
61 ANSI color sequences
62 The color sequences are composed of sequences of numbers separated by
63 semicolons. The most common codes are:
64
65 ┌───┬──────────────────────────┐
66 │ │ │
67 │0 │ to restore default color │
68 ├───┼──────────────────────────┤
69 │ │ │
70 │1 │ for brighter colors │
71 ├───┼──────────────────────────┤
72 │ │ │
73 │4 │ for underlined text │
74 ├───┼──────────────────────────┤
75 │ │ │
76 │5 │ for flashing text │
77 ├───┼──────────────────────────┤
78 │ │ │
79 │30 │ for black foreground │
80 ├───┼──────────────────────────┤
81 │ │ │
82 │31 │ for red foreground │
83 ├───┼──────────────────────────┤
84 │ │ │
85 │32 │ for green foreground │
86 ├───┼──────────────────────────┤
87 │ │ │
88 │33 │ for yellow (or brown) │
89 │ │ foreground │
90 ├───┼──────────────────────────┤
91 │ │ │
92 │34 │ for blue foreground │
93 ├───┼──────────────────────────┤
94 │ │ │
95 │35 │ for purple foreground │
96 ├───┼──────────────────────────┤
97 │ │ │
98 │36 │ for cyan foreground │
99 ├───┼──────────────────────────┤
100 │ │ │
101 │37 │ for white (or gray) │
102 │ │ foreground │
103 ├───┼──────────────────────────┤
104 │ │ │
105 │40 │ for black background │
106 ├───┼──────────────────────────┤
107 │ │ │
108 │41 │ for red background │
109 ├───┼──────────────────────────┤
110 │ │ │
111 │42 │ for green background │
112 ├───┼──────────────────────────┤
113 │ │ │
114 │43 │ for yellow (or brown) │
115 │ │ background │
116 ├───┼──────────────────────────┤
117 │ │ │
118 │44 │ for blue background │
119 ├───┼──────────────────────────┤
120 │ │ │
121 │45 │ for purple background │
122 ├───┼──────────────────────────┤
123 │ │ │
124 │46 │ for cyan background │
125 ├───┼──────────────────────────┤
126 │ │ │
127 │47 │ for white (or gray) │
128 │ │ background │
129 └───┴──────────────────────────┘
130
131 Escape sequences
132 To specify control or blank characters in the color sequences,
133 C-style \-escaped notation can be used:
134
135 ┌───┬────────────────────────┐
136 │ │ │
137 │\a │ Bell (ASCII 7) │
138 ├───┼────────────────────────┤
139 │ │ │
140 │\b │ Backspace (ASCII 8) │
141 ├───┼────────────────────────┤
142 │ │ │
143 │\e │ Escape (ASCII 27) │
144 ├───┼────────────────────────┤
145 │ │ │
146 │\f │ Form feed (ASCII 12) │
147 ├───┼────────────────────────┤
148 │ │ │
149 │\n │ Newline (ASCII 10) │
150 ├───┼────────────────────────┤
151 │ │ │
152 │\r │ Carriage Return (ASCII │
153 │ │ 13) │
154 ├───┼────────────────────────┤
155 │ │ │
156 │\t │ Tab (ASCII 9) │
157 ├───┼────────────────────────┤
158 │ │ │
159 │\v │ Vertical Tab (ASCII │
160 │ │ 11) │
161 ├───┼────────────────────────┤
162 │ │ │
163 │\? │ Delete (ASCII 127) │
164 ├───┼────────────────────────┤
165 │ │ │
166 │\_ │ Space │
167 ├───┼────────────────────────┤
168 │ │ │
169 │\\ │ Backslash (\) │
170 ├───┼────────────────────────┤
171 │ │ │
172 │\^ │ Caret (^) │
173 ├───┼────────────────────────┤
174 │ │ │
175 │\# │ Hash mark (#) │
176 └───┴────────────────────────┘
177
178 Please note that escapes are necessary to enter a space,
179 backslash, caret, or any control character anywhere in the
180 string, as well as a hash mark as the first character.
181
182 For example, to use a red background for alert messages in
183 the output of dmesg(1), use:
184
185 echo 'alert 37;41' >>
186 /etc/terminal-colors.d/dmesg.scheme
187
188 Comments
189 Lines where the first non-blank character is a # (hash) are
190 ignored. Any other use of the hash character is not
191 interpreted as introducing a comment.
192
194 TERMINAL_COLORS_DEBUG=all
195 enables debug output.
196
198 $XDG_CONFIG_HOME/terminal-colors.d
199
200 $HOME/.config/terminal-colors.d
201
202 /etc/terminal-colors.d
203
205 Disable colors for all compatible utilities:
206
207 touch /etc/terminal-colors.d/disable
208
209 Disable colors for all compatible utils on a vt100
210 terminal:
211
212 touch /etc/terminal-colors.d/@vt100.disable
213
214 Disable colors for all compatible utils except dmesg(1):
215
216 touch /etc/terminal-colors.d/disable
217
218 touch /etc/terminal-colors.d/dmesg.enable
219
221 The terminal-colors.d functionality is currently supported
222 by all util-linux utilities which provides colorized
223 output. For more details always see the COLORS section in
224 the man page for the utility.
225
227 For bug reports, use the issue tracker at
228 https://github.com/util-linux/util-linux/issues.
229
231 terminal-colors.d is part of the util-linux package which
232 can be downloaded from Linux Kernel Archive
233 <https://www.kernel.org/pub/linux/utils/util-linux/>.
234
235
236
237util-linux 2.39.2 2023-06-14 TERMINAL-COLORS.D(5)