1 <!-- doc/src/sgml/color.sgml -->
4 <title>Color Support
</title>
6 <indexterm zone=
"color">
7 <primary>color
</primary>
11 Most programs in the PostgreSQL package can produce colorized console
12 output. This appendix describes how that is configured.
15 <sect1 id=
"color-when">
16 <title>When Color is Used
</title>
19 To use colorized output, set the environment variable
20 <envar>PG_COLOR
</envar><indexterm><primary>PG_COLOR
</primary></indexterm>
26 If the value is
<literal>always
</literal>, then color is used.
32 If the value is
<literal>auto
</literal> and the standard error stream
33 is associated with a terminal device, then color is used.
39 Otherwise, color is not used.
46 <sect1 id=
"color-which">
47 <title>Configuring the Colors
</title>
50 The actual colors to be used are configured using the environment variable
51 <envar>PG_COLORS
</envar><indexterm><primary>PG_COLORS
</primary></indexterm>
52 (note plural). The value is a colon-separated list of
53 <literal><replaceable>key
</replaceable>=
<replaceable>value
</replaceable></literal>
54 pairs. The keys specify what the color is to be used for. The values are
55 SGR (Select Graphic Rendition) specifications, which are interpreted by the
60 The following keys are currently in use:
63 <term><literal>error
</literal></term>
65 <para>used to highlight the text
<quote>error
</quote> in error messages
</para>
70 <term><literal>warning
</literal></term>
72 <para>used to highlight the text
<quote>warning
</quote> in warning
78 <term><literal>note
</literal></term>
80 <para>used to highlight the text
<quote>detail
</quote> and
81 <quote>hint
</quote> in such messages
</para>
86 <term><literal>locus
</literal></term>
88 <para>used to highlight location information (e.g., program name and
89 file name) in messages
</para>
97 <literal>error=
01;
31:warning=
01;
35:note=
01;
36:locus=
01</literal>
98 (
<literal>01;
31</literal> = bold red,
<literal>01;
35</literal> = bold
99 magenta,
<literal>01;
36</literal> = bold cyan,
<literal>01</literal> = bold
105 This color specification format is also used by other software packages
106 such as
<productname>GCC
</productname>,
<productname>GNU
107 coreutils
</productname>, and
<productname>GNU grep
</productname>.