##// END OF EJS Templates
color: update main documentation...
Pierre-Yves David -
r31123:df0a0734 default
parent child Browse files
Show More
@@ -15,6 +15,7 b''
15 15 <DirectoryRef Id="INSTALLDIR">
16 16 <Directory Id="helpdir" Name="help" FileSource="$(var.SourceDir)">
17 17 <Component Id="help.root" Guid="$(var.help.root.guid)" Win64='$(var.IsX64)'>
18 <File Name="color.txt" />
18 19 <File Name="config.txt" KeyPath="yes" />
19 20 <File Name="dates.txt" />
20 21 <File Name="diffs.txt" />
@@ -5,169 +5,20 b''
5 5 # This software may be used and distributed according to the terms of the
6 6 # GNU General Public License version 2 or any later version.
7 7
8 '''colorize output from some commands
9
10 The color extension colorizes output from several Mercurial commands.
11 For example, the diff command shows additions in green and deletions
12 in red, while the status command shows modified files in magenta. Many
13 other commands have analogous colors. It is possible to customize
14 these colors.
15
16 Effects
17 -------
18
19 Other effects in addition to color, like bold and underlined text, are
20 also available. By default, the terminfo database is used to find the
21 terminal codes used to change color and effect. If terminfo is not
22 available, then effects are rendered with the ECMA-48 SGR control
23 function (aka ANSI escape codes).
24
25 The available effects in terminfo mode are 'blink', 'bold', 'dim',
26 'inverse', 'invisible', 'italic', 'standout', and 'underline'; in
27 ECMA-48 mode, the options are 'bold', 'inverse', 'italic', and
28 'underline'. How each is rendered depends on the terminal emulator.
29 Some may not be available for a given terminal type, and will be
30 silently ignored.
31
32 If the terminfo entry for your terminal is missing codes for an effect
33 or has the wrong codes, you can add or override those codes in your
34 configuration::
35
36 [color]
37 terminfo.dim = \E[2m
38
39 where '\E' is substituted with an escape character.
8 '''enable Mercurial color mode (DEPRECATED)
40 9
41 Labels
42 ------
43
44 Text receives color effects depending on the labels that it has. Many
45 default Mercurial commands emit labelled text. You can also define
46 your own labels in templates using the label function, see :hg:`help
47 templates`. A single portion of text may have more than one label. In
48 that case, effects given to the last label will override any other
49 effects. This includes the special "none" effect, which nullifies
50 other effects.
51
52 Labels are normally invisible. In order to see these labels and their
53 position in the text, use the global --color=debug option. The same
54 anchor text may be associated to multiple labels, e.g.
55
56 [log.changeset changeset.secret|changeset: 22611:6f0a53c8f587]
57
58 The following are the default effects for some default labels. Default
59 effects may be overridden from your configuration file::
60
61 [color]
62 status.modified = blue bold underline red_background
63 status.added = green bold
64 status.removed = red bold blue_background
65 status.deleted = cyan bold underline
66 status.unknown = magenta bold underline
67 status.ignored = black bold
68
69 # 'none' turns off all effects
70 status.clean = none
71 status.copied = none
72
73 qseries.applied = blue bold underline
74 qseries.unapplied = black bold
75 qseries.missing = red bold
10 This extensions enable Mercurial color mode. The feature is now directly
11 available in Mercurial core. You can access it using::
76 12
77 diff.diffline = bold
78 diff.extended = cyan bold
79 diff.file_a = red bold
80 diff.file_b = green bold
81 diff.hunk = magenta
82 diff.deleted = red
83 diff.inserted = green
84 diff.changed = white
85 diff.tab =
86 diff.trailingwhitespace = bold red_background
87
88 # Blank so it inherits the style of the surrounding label
89 changeset.public =
90 changeset.draft =
91 changeset.secret =
92
93 resolve.unresolved = red bold
94 resolve.resolved = green bold
95
96 bookmarks.active = green
97
98 branches.active = none
99 branches.closed = black bold
100 branches.current = green
101 branches.inactive = none
102
103 tags.normal = green
104 tags.local = black bold
105
106 rebase.rebased = blue
107 rebase.remaining = red bold
108
109 shelve.age = cyan
110 shelve.newest = green bold
111 shelve.name = blue bold
112
113 histedit.remaining = red bold
114
115 Custom colors
116 -------------
13 [ui]
14 color = auto
117 15
118 Because there are only eight standard colors, this module allows you
119 to define color names for other color slots which might be available
120 for your terminal type, assuming terminfo mode. For instance::
121
122 color.brightblue = 12
123 color.pink = 207
124 color.orange = 202
125
126 to set 'brightblue' to color slot 12 (useful for 16 color terminals
127 that have brighter colors defined in the upper eight) and, 'pink' and
128 'orange' to colors in 256-color xterm's default color cube. These
129 defined colors may then be used as any of the pre-defined eight,
130 including appending '_background' to set the background to that color.
131
132 Modes
133 -----
134
135 By default, the color extension will use ANSI mode (or win32 mode on
136 Windows) if it detects a terminal. To override auto mode (to enable
137 terminfo mode, for example), set the following configuration option::
138
139 [color]
140 mode = terminfo
141
142 Any value other than 'ansi', 'win32', 'terminfo', or 'auto' will
143 disable color.
144
145 Note that on some systems, terminfo mode may cause problems when using
146 color with the pager extension and less -R. less with the -R option
147 will only display ECMA-48 color codes, and terminfo mode may sometimes
148 emit codes that less doesn't understand. You can work around this by
149 either using ansi mode (or auto mode), or by using less -r (which will
150 pass through all terminal control codes, not just color control
151 codes).
152
153 On some systems (such as MSYS in Windows), the terminal may support
154 a different color mode than the pager (activated via the "pager"
155 extension). It is possible to define separate modes depending on whether
156 the pager is active::
157
158 [color]
159 mode = auto
160 pagermode = ansi
161
162 If ``pagermode`` is not defined, the ``mode`` will be used.
16 See :hg:`help color` for details.
163 17 '''
164 18
165 19 from __future__ import absolute_import
166 20
167 from mercurial import (
168 color,
169 commands
170 )
21 from mercurial import color
171 22
172 23 # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for
173 24 # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should
@@ -178,9 +29,3 b" testedwith = 'ships-with-hg-core'"
178 29 def extsetup(ui):
179 30 # change default color config
180 31 color._enabledbydefault = True
181 for idx, entry in enumerate(commands.globalopts):
182 if entry[1] == 'color':
183 patch = (entry[3].replace(' (EXPERIMENTAL)', ''),)
184 new = entry[:3] + patch + entry[4:]
185 commands.globalopts[idx] = new
186 break
@@ -187,7 +187,6 b' def _modesetup(ui):'
187 187 default = 'never'
188 188 if _enabledbydefault:
189 189 default = 'auto'
190 # experimental config: ui.color
191 190 config = ui.config('ui', 'color', default)
192 191 if config == 'debug':
193 192 return 'debug'
@@ -80,8 +80,7 b' globalopts = ['
80 80 ('', 'color', '',
81 81 # i18n: 'always', 'auto', 'never', and 'debug' are keywords
82 82 # and should not be translated
83 _("when to colorize (boolean, always, auto, never, or debug)"
84 " (EXPERIMENTAL)"),
83 _("when to colorize (boolean, always, auto, never, or debug)"),
85 84 _('TYPE')),
86 85 ('', 'config', [],
87 86 _('set/override config option (use \'section.name=value\')'),
@@ -1,20 +1,24 b''
1 # color.py color output for Mercurial commands
2 #
3 # Copyright (C) 2007 Kevin Christen <kevin.christen@gmail.com>
4 #
5 # This software may be used and distributed according to the terms of the
6 # GNU General Public License version 2 or any later version.
1 Mercurial can colorizes output from several commands.
7 2
8 '''colorize output from some commands
9
10 The color extension colorizes output from several Mercurial commands.
11 3 For example, the diff command shows additions in green and deletions
12 4 in red, while the status command shows modified files in magenta. Many
13 5 other commands have analogous colors. It is possible to customize
14 6 these colors.
15 7
8 To enable color use::
9
10 [ui]
11 color = auto
12
13 Mode
14 ====
15
16 Mercurial can use various system to display color. The supported modes are
17 ``ansi``, ``win32``, and ``terminfo``. See :hg:`help config.color` for details
18 about how to control the mode
19
16 20 Effects
17 -------
21 =======
18 22
19 23 Other effects in addition to color, like bold and underlined text, are
20 24 also available. By default, the terminfo database is used to find the
@@ -39,7 +43,7 b' configuration::'
39 43 where '\E' is substituted with an escape character.
40 44
41 45 Labels
42 ------
46 ======
43 47
44 48 Text receives color effects depending on the labels that it has. Many
45 49 default Mercurial commands emit labelled text. You can also define
@@ -113,7 +117,7 b' effects may be overridden from your conf'
113 117 histedit.remaining = red bold
114 118
115 119 Custom colors
116 -------------
120 =============
117 121
118 122 Because there are only eight standard colors, this module allows you
119 123 to define color names for other color slots which might be available
@@ -128,59 +132,3 b' that have brighter colors defined in the'
128 132 'orange' to colors in 256-color xterm's default color cube. These
129 133 defined colors may then be used as any of the pre-defined eight,
130 134 including appending '_background' to set the background to that color.
131
132 Modes
133 -----
134
135 By default, the color extension will use ANSI mode (or win32 mode on
136 Windows) if it detects a terminal. To override auto mode (to enable
137 terminfo mode, for example), set the following configuration option::
138
139 [color]
140 mode = terminfo
141
142 Any value other than 'ansi', 'win32', 'terminfo', or 'auto' will
143 disable color.
144
145 Note that on some systems, terminfo mode may cause problems when using
146 color with the pager extension and less -R. less with the -R option
147 will only display ECMA-48 color codes, and terminfo mode may sometimes
148 emit codes that less doesn't understand. You can work around this by
149 either using ansi mode (or auto mode), or by using less -r (which will
150 pass through all terminal control codes, not just color control
151 codes).
152
153 On some systems (such as MSYS in Windows), the terminal may support
154 a different color mode than the pager (activated via the "pager"
155 extension). It is possible to define separate modes depending on whether
156 the pager is active::
157
158 [color]
159 mode = auto
160 pagermode = ansi
161
162 If ``pagermode`` is not defined, the ``mode`` will be used.
163 '''
164
165 from __future__ import absolute_import
166
167 from mercurial import (
168 color,
169 commands
170 )
171
172 # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for
173 # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should
174 # be specifying the version(s) of Mercurial they are tested with, or
175 # leave the attribute unspecified.
176 testedwith = 'ships-with-hg-core'
177
178 def extsetup(ui):
179 # change default color config
180 color._enabledbydefault = True
181 for idx, entry in enumerate(commands.globalopts):
182 if entry[1] == 'color':
183 patch = (entry[3].replace(' (EXPERIMENTAL)', ''),)
184 new = entry[:3] + patch + entry[4:]
185 commands.globalopts[idx] = new
186 break
@@ -386,6 +386,33 b' Supported arguments:'
386 386 If no suitable authentication entry is found, the user is prompted
387 387 for credentials as usual if required by the remote.
388 388
389 ``color``
390 ---------
391
392 Configure the Mercurial color mode. For details about how to define your custom
393 effect and style see :hg:`help color`.
394
395 ``mode``
396 String: control the method used to output color. One of ``auto``, ``ansi``,
397 ``win32``, ``terminfo`` or ``debug``. In auto mode the color extension will
398 use ANSI mode by default (or win32 mode on Windows) if it detects a
399 terminal. Any invalid value will disable color.
400
401 ``pagermode``
402 String: optinal override of ``color.mode`` used with pager (from the pager
403 extensions).
404
405 On some systems, terminfo mode may cause problems when using
406 color with the pager extension and less -R. less with the -R option
407 will only display ECMA-48 color codes, and terminfo mode may sometimes
408 emit codes that less doesn't understand. You can work around this by
409 either using ansi mode (or auto mode), or by using less -r (which will
410 pass through all terminal control codes, not just color control
411 codes).
412
413 On some systems (such as MSYS in Windows), the terminal may support
414 a different color mode than the pager (activated via the "pager"
415 extension).
389 416
390 417 ``committemplate``
391 418 ------------------
@@ -1797,6 +1824,13 b' User interface controls.'
1797 1824
1798 1825 By default, the first bundle advertised by the server is used.
1799 1826
1827 ``color``
1828 String: when to use to colorize output. possible value are auto, always,
1829 never, or debug (default: never). 'auto' will use color whenever it seems
1830 possible. See :hg:`help color` for details.
1831
1832 (in addition a boolean can be used in place always/never)
1833
1800 1834 ``commitsubrepos``
1801 1835 Whether to commit modified subrepositories when committing the
1802 1836 parent repository. If False and one subrepository has uncommitted
@@ -533,7 +533,7 b' hide outer repo'
533 533 -q --quiet suppress output
534 534 -v --verbose enable additional output
535 535 --color TYPE when to colorize (boolean, always, auto, never, or
536 debug) (EXPERIMENTAL)
536 debug)
537 537 --config CONFIG [+] set/override config option (use 'section.name=value')
538 538 --debug enable debugging output
539 539 --debugger start debugger
@@ -572,7 +572,7 b' hide outer repo'
572 572 -q --quiet suppress output
573 573 -v --verbose enable additional output
574 574 --color TYPE when to colorize (boolean, always, auto, never, or
575 debug) (EXPERIMENTAL)
575 debug)
576 576 --config CONFIG [+] set/override config option (use 'section.name=value')
577 577 --debug enable debugging output
578 578 --debugger start debugger
@@ -854,7 +854,7 b' extension help itself'
854 854 -q --quiet suppress output
855 855 -v --verbose enable additional output
856 856 --color TYPE when to colorize (boolean, always, auto, never, or
857 debug) (EXPERIMENTAL)
857 debug)
858 858 --config CONFIG [+] set/override config option (use 'section.name=value')
859 859 --debug enable debugging output
860 860 --debugger start debugger
@@ -891,7 +891,7 b" Make sure that single '-v' option shows "
891 891 -q --quiet suppress output
892 892 -v --verbose enable additional output
893 893 --color TYPE when to colorize (boolean, always, auto, never, or
894 debug) (EXPERIMENTAL)
894 debug)
895 895 --config CONFIG [+] set/override config option (use 'section.name=value')
896 896 --debug enable debugging output
897 897 --debugger start debugger
@@ -966,7 +966,7 b" help options '-v' and '-v -e' should be "
966 966 -q --quiet suppress output
967 967 -v --verbose enable additional output
968 968 --color TYPE when to colorize (boolean, always, auto, never, or
969 debug) (EXPERIMENTAL)
969 debug)
970 970 --config CONFIG [+] set/override config option (use 'section.name=value')
971 971 --debug enable debugging output
972 972 --debugger start debugger
@@ -1002,7 +1002,7 b" help options '-v' and '-v -e' should be "
1002 1002 -q --quiet suppress output
1003 1003 -v --verbose enable additional output
1004 1004 --color TYPE when to colorize (boolean, always, auto, never, or
1005 debug) (EXPERIMENTAL)
1005 debug)
1006 1006 --config CONFIG [+] set/override config option (use 'section.name=value')
1007 1007 --debug enable debugging output
1008 1008 --debugger start debugger
@@ -250,7 +250,6 b' Test extension help:'
250 250 censor erase file content at a given revision
251 251 churn command to display statistics about repository history
252 252 clonebundles advertise pre-generated bundles to seed clones
253 color colorize output from some commands
254 253 convert import revisions from foreign VCS repositories into
255 254 Mercurial
256 255 eol automatically manage newlines in repository files
@@ -317,7 +316,7 b' Test short command list with verbose opt'
317 316 -q --quiet suppress output
318 317 -v --verbose enable additional output
319 318 --color TYPE when to colorize (boolean, always, auto, never, or
320 debug) (EXPERIMENTAL)
319 debug)
321 320 --config CONFIG [+] set/override config option (use 'section.name=value')
322 321 --debug enable debugging output
323 322 --debugger start debugger
@@ -417,7 +416,7 b' Verbose help for add'
417 416 -q --quiet suppress output
418 417 -v --verbose enable additional output
419 418 --color TYPE when to colorize (boolean, always, auto, never, or
420 debug) (EXPERIMENTAL)
419 debug)
421 420 --config CONFIG [+] set/override config option (use 'section.name=value')
422 421 --debug enable debugging output
423 422 --debugger start debugger
@@ -2522,7 +2521,7 b' Dish up an empty repo; serve it cold.'
2522 2521 <td>enable additional output</td></tr>
2523 2522 <tr><td></td>
2524 2523 <td>--color TYPE</td>
2525 <td>when to colorize (boolean, always, auto, never, or debug) (EXPERIMENTAL)</td></tr>
2524 <td>when to colorize (boolean, always, auto, never, or debug)</td></tr>
2526 2525 <tr><td></td>
2527 2526 <td>--config CONFIG [+]</td>
2528 2527 <td>set/override config option (use 'section.name=value')</td></tr>
@@ -2723,7 +2722,7 b' Dish up an empty repo; serve it cold.'
2723 2722 <td>enable additional output</td></tr>
2724 2723 <tr><td></td>
2725 2724 <td>--color TYPE</td>
2726 <td>when to colorize (boolean, always, auto, never, or debug) (EXPERIMENTAL)</td></tr>
2725 <td>when to colorize (boolean, always, auto, never, or debug)</td></tr>
2727 2726 <tr><td></td>
2728 2727 <td>--config CONFIG [+]</td>
2729 2728 <td>set/override config option (use 'section.name=value')</td></tr>
General Comments 0
You need to be logged in to leave comments. Login now