| 1 |
<?xml version="1.0" encoding="utf-8"?> |
| 2 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
| 3 |
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> |
| 4 |
<head> |
| 5 |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
| 6 |
<meta name="generator" content="Docutils 0.21.2: https://docutils.sourceforge.io/" /> |
| 7 |
<title>Colorizing Outputs</title> |
| 8 |
<link rel="stylesheet" href="../style.css" type="text/css" /> |
| 9 |
</head> |
| 10 |
<body> |
| 11 |
<div class="document" id="colorizing-outputs"> |
| 12 |
<span id="topic-color"></span> |
| 13 |
<h1 class="title">Colorizing Outputs</h1> |
| 14 |
|
| 15 |
<div class="contents htmlonly topic" id="contents"> |
| 16 |
<p class="topic-title"><a class="reference internal" href="#top">Contents</a></p> |
| 17 |
<ul class="simple"> |
| 18 |
<li><a class="reference internal" href="#mode" id="toc-entry-1">Mode</a></li> |
| 19 |
<li><a class="reference internal" href="#effects" id="toc-entry-2">Effects</a></li> |
| 20 |
<li><a class="reference internal" href="#labels" id="toc-entry-3">Labels</a></li> |
| 21 |
<li><a class="reference internal" href="#custom-colors" id="toc-entry-4">Custom colors</a></li> |
| 22 |
</ul> |
| 23 |
</div> |
| 24 |
<p id="color">Mercurial colorizes output from several commands.</p> |
| 25 |
<p>For example, the diff command shows additions in green and deletions |
| 26 |
in red, while the status command shows modified files in magenta. Many |
| 27 |
other commands have analogous colors. It is possible to customize |
| 28 |
these colors.</p> |
| 29 |
<p>To enable color (default) whenever possible use:</p> |
| 30 |
<pre class="literal-block"> |
| 31 |
[ui] |
| 32 |
color = yes |
| 33 |
</pre> |
| 34 |
<p>To disable color use:</p> |
| 35 |
<pre class="literal-block"> |
| 36 |
[ui] |
| 37 |
color = no |
| 38 |
</pre> |
| 39 |
<p>See <a class="reference external" href="hgrc.5.html#ui"><tt class="docutils literal">hg help config.ui.color</tt></a> for details.</p> |
| 40 |
<div class="windows docutils container"> |
| 41 |
The default pager on Windows does not support color, so enabling the pager |
| 42 |
will effectively disable color. See <a class="reference external" href="hgrc.5.html#ui"><tt class="docutils literal">hg help config.ui.paginate</tt></a> to disable |
| 43 |
the pager. Alternately, MSYS and Cygwin shells provide <cite>less</cite> as a pager, |
| 44 |
which can be configured to support ANSI color mode. Windows 10 natively |
| 45 |
supports ANSI color mode.</div> |
| 46 |
<div class="section" id="mode"> |
| 47 |
<h1><a class="toc-backref" href="#contents">Mode</a></h1> |
| 48 |
<p>Mercurial can use various systems to display color. The supported modes are |
| 49 |
<tt class="docutils literal">ansi</tt>, <tt class="docutils literal">win32</tt>, and <tt class="docutils literal">terminfo</tt>. See <a class="reference external" href="hgrc.5.html#color"><tt class="docutils literal">hg help config.color</tt></a> for details |
| 50 |
about how to control the mode.</p> |
| 51 |
</div> |
| 52 |
<div class="section" id="effects"> |
| 53 |
<h1><a class="toc-backref" href="#contents">Effects</a></h1> |
| 54 |
<p>Other effects in addition to color, like bold and underlined text, are |
| 55 |
also available. By default, the terminfo database is used to find the |
| 56 |
terminal codes used to change color and effect. If terminfo is not |
| 57 |
available, then effects are rendered with the ECMA-48 SGR control |
| 58 |
function (aka ANSI escape codes).</p> |
| 59 |
<p>The available effects in terminfo mode are 'blink', 'bold', 'dim', |
| 60 |
'inverse', 'invisible', 'italic', 'standout', and 'underline'; in |
| 61 |
ECMA-48 mode, the options are 'bold', 'inverse', 'italic', and |
| 62 |
'underline'. How each is rendered depends on the terminal emulator. |
| 63 |
Some may not be available for a given terminal type, and will be |
| 64 |
silently ignored.</p> |
| 65 |
<p>If the terminfo entry for your terminal is missing codes for an effect |
| 66 |
or has the wrong codes, you can add or override those codes in your |
| 67 |
configuration:</p> |
| 68 |
<pre class="literal-block"> |
| 69 |
[color] |
| 70 |
terminfo.dim = \E[2m |
| 71 |
</pre> |
| 72 |
<p>where 'E' is substituted with an escape character.</p> |
| 73 |
</div> |
| 74 |
<div class="section" id="labels"> |
| 75 |
<h1><a class="toc-backref" href="#contents">Labels</a></h1> |
| 76 |
<p>Text receives color effects depending on the labels that it has. Many |
| 77 |
default Mercurial commands emit labelled text. You can also define |
| 78 |
your own labels in templates using the label function, see <a class="reference external" href="hg.1.html#templates"><tt class="docutils literal">hg help |
| 79 |
templates</tt></a>. In order to receive effects, labels must have a dot, such |
| 80 |
as <cite>log.secret</cite> or <cite>branch.active</cite>. A single portion of text may have |
| 81 |
more than one label. In that case, effects given to the last label |
| 82 |
will override any other effects. This includes the special "none" |
| 83 |
effect, which nullifies other effects.</p> |
| 84 |
<p>Labels are normally invisible. In order to see these labels and their |
| 85 |
position in the text, use the global --color=debug option. The same |
| 86 |
anchor text may be associated to multiple labels, e.g.</p> |
| 87 |
<blockquote> |
| 88 |
[log.changeset changeset.secret|changeset: 22611:6f0a53c8f587]</blockquote> |
| 89 |
<p>The following are the default effects for some default labels. Default |
| 90 |
effects may be overridden from your configuration file:</p> |
| 91 |
<pre class="literal-block"> |
| 92 |
[color] |
| 93 |
status.modified = blue bold underline red_background |
| 94 |
status.added = green bold |
| 95 |
status.removed = red bold blue_background |
| 96 |
status.deleted = cyan bold underline |
| 97 |
status.unknown = magenta bold underline |
| 98 |
status.ignored = black bold |
| 99 |
|
| 100 |
# 'none' turns off all effects |
| 101 |
status.clean = none |
| 102 |
status.copied = none |
| 103 |
|
| 104 |
qseries.applied = blue bold underline |
| 105 |
qseries.unapplied = black bold |
| 106 |
qseries.missing = red bold |
| 107 |
|
| 108 |
diff.diffline = bold |
| 109 |
diff.extended = cyan bold |
| 110 |
diff.file_a = red bold |
| 111 |
diff.file_b = green bold |
| 112 |
diff.hunk = magenta |
| 113 |
diff.deleted = red |
| 114 |
diff.inserted = green |
| 115 |
diff.changed = white |
| 116 |
diff.tab = |
| 117 |
diff.trailingwhitespace = bold red_background |
| 118 |
|
| 119 |
# Blank so it inherits the style of the surrounding label |
| 120 |
changeset.public = |
| 121 |
changeset.draft = |
| 122 |
changeset.secret = |
| 123 |
|
| 124 |
resolve.unresolved = red bold |
| 125 |
resolve.resolved = green bold |
| 126 |
|
| 127 |
bookmarks.active = green |
| 128 |
|
| 129 |
branches.active = none |
| 130 |
branches.closed = black bold |
| 131 |
branches.current = green |
| 132 |
branches.inactive = none |
| 133 |
|
| 134 |
tags.normal = green |
| 135 |
tags.local = black bold |
| 136 |
|
| 137 |
rebase.rebased = blue |
| 138 |
rebase.remaining = red bold |
| 139 |
|
| 140 |
shelve.age = cyan |
| 141 |
shelve.newest = green bold |
| 142 |
shelve.name = blue bold |
| 143 |
|
| 144 |
histedit.remaining = red bold |
| 145 |
</pre> |
| 146 |
</div> |
| 147 |
<div class="section" id="custom-colors"> |
| 148 |
<h1><a class="toc-backref" href="#contents">Custom colors</a></h1> |
| 149 |
<p>Because there are only eight standard colors, Mercurial allows you |
| 150 |
to define color names for other color slots which might be available |
| 151 |
for your terminal type, assuming terminfo mode. For instance:</p> |
| 152 |
<pre class="literal-block"> |
| 153 |
color.brightblue = 12 |
| 154 |
color.pink = 207 |
| 155 |
color.orange = 202 |
| 156 |
</pre> |
| 157 |
<p>to set 'brightblue' to color slot 12 (useful for 16 color terminals |
| 158 |
that have brighter colors defined in the upper eight) and, 'pink' and |
| 159 |
'orange' to colors in 256-color xterm's default color cube. These |
| 160 |
defined colors may then be used as any of the pre-defined eight, |
| 161 |
including appending '_background' to set the background to that color.</p> |
| 162 |
</div> |
| 163 |
</div> |
| 164 |
</body> |
| 165 |
</html> |