9.11.1 The --color option

The ‘--color=when’ option specifies under which conditions colorized output should be generated. The when part can be one of the following:

always

yes

The output will be colorized.
never

no

The output will not be colorized.
auto

tty

The output will be colorized if the output device is a tty, i.e. when the output goes directly to a text screen or terminal emulator window.
html
The output will be colorized and be in HTML format.
test
This is a special value, understood only by the msgcat program. It is explained in the next section (The TERM variable).

--color’ is equivalent to ‘--color=yes’. The default is ‘--color=auto’.

Thus, a command like ‘msgcat vi.po’ will produce colorized output when called by itself in a command window. Whereas in a pipe, such as ‘msgcat vi.po | less -R’, it will not produce colorized output. To get colorized output in this situation nevertheless, use the command ‘msgcat --color vi.po | less -R’.

The ‘--color=html’ option will produce output that can be viewed in a browser. This can be useful, for example, for Indic languages, because the renderic of Indic scripts in browsers is usually better than in terminal emulators.

Note that the output produced with the --color option is not a valid PO file in itself. It contains additional terminal-specific escape sequences or HTML tags. A PO file reader will give a syntax error when confronted with such content. Except for the ‘--color=html’ case, you therefore normally don’t need to save output produced with the --color option in a file.