##// 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 <DirectoryRef Id="INSTALLDIR">
15 <DirectoryRef Id="INSTALLDIR">
16 <Directory Id="helpdir" Name="help" FileSource="$(var.SourceDir)">
16 <Directory Id="helpdir" Name="help" FileSource="$(var.SourceDir)">
17 <Component Id="help.root" Guid="$(var.help.root.guid)" Win64='$(var.IsX64)'>
17 <Component Id="help.root" Guid="$(var.help.root.guid)" Win64='$(var.IsX64)'>
18 <File Name="color.txt" />
18 <File Name="config.txt" KeyPath="yes" />
19 <File Name="config.txt" KeyPath="yes" />
19 <File Name="dates.txt" />
20 <File Name="dates.txt" />
20 <File Name="diffs.txt" />
21 <File Name="diffs.txt" />
@@ -5,169 +5,20 b''
5 # This software may be used and distributed according to the terms of the
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.
6 # GNU General Public License version 2 or any later version.
7
7
8 '''colorize output from some commands
8 '''enable Mercurial color mode (DEPRECATED)
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.
40
9
41 Labels
10 This extensions enable Mercurial color mode. The feature is now directly
42 ------
11 available in Mercurial core. You can access it using::
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
76
12
77 diff.diffline = bold
13 [ui]
78 diff.extended = cyan bold
14 color = auto
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 -------------
117
15
118 Because there are only eight standard colors, this module allows you
16 See :hg:`help color` for details.
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.
163 '''
17 '''
164
18
165 from __future__ import absolute_import
19 from __future__ import absolute_import
166
20
167 from mercurial import (
21 from mercurial import color
168 color,
169 commands
170 )
171
22
172 # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for
23 # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for
173 # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should
24 # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should
@@ -178,9 +29,3 b" testedwith = 'ships-with-hg-core'"
178 def extsetup(ui):
29 def extsetup(ui):
179 # change default color config
30 # change default color config
180 color._enabledbydefault = True
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 default = 'never'
187 default = 'never'
188 if _enabledbydefault:
188 if _enabledbydefault:
189 default = 'auto'
189 default = 'auto'
190 # experimental config: ui.color
191 config = ui.config('ui', 'color', default)
190 config = ui.config('ui', 'color', default)
192 if config == 'debug':
191 if config == 'debug':
193 return 'debug'
192 return 'debug'
@@ -80,8 +80,7 b' globalopts = ['
80 ('', 'color', '',
80 ('', 'color', '',
81 # i18n: 'always', 'auto', 'never', and 'debug' are keywords
81 # i18n: 'always', 'auto', 'never', and 'debug' are keywords
82 # and should not be translated
82 # and should not be translated
83 _("when to colorize (boolean, always, auto, never, or debug)"
83 _("when to colorize (boolean, always, auto, never, or debug)"),
84 " (EXPERIMENTAL)"),
85 _('TYPE')),
84 _('TYPE')),
86 ('', 'config', [],
85 ('', 'config', [],
87 _('set/override config option (use \'section.name=value\')'),
86 _('set/override config option (use \'section.name=value\')'),
@@ -1,20 +1,24 b''
1 # color.py color output for Mercurial commands
1 Mercurial can colorizes output from several 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.
7
2
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
3 For example, the diff command shows additions in green and deletions
12 in red, while the status command shows modified files in magenta. Many
4 in red, while the status command shows modified files in magenta. Many
13 other commands have analogous colors. It is possible to customize
5 other commands have analogous colors. It is possible to customize
14 these colors.
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 Effects
20 Effects
17 -------
21 =======
18
22
19 Other effects in addition to color, like bold and underlined text, are
23 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
24 also available. By default, the terminfo database is used to find the
@@ -39,7 +43,7 b' configuration::'
39 where '\E' is substituted with an escape character.
43 where '\E' is substituted with an escape character.
40
44
41 Labels
45 Labels
42 ------
46 ======
43
47
44 Text receives color effects depending on the labels that it has. Many
48 Text receives color effects depending on the labels that it has. Many
45 default Mercurial commands emit labelled text. You can also define
49 default Mercurial commands emit labelled text. You can also define
@@ -113,7 +117,7 b' effects may be overridden from your conf'
113 histedit.remaining = red bold
117 histedit.remaining = red bold
114
118
115 Custom colors
119 Custom colors
116 -------------
120 =============
117
121
118 Because there are only eight standard colors, this module allows you
122 Because there are only eight standard colors, this module allows you
119 to define color names for other color slots which might be available
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 'orange' to colors in 256-color xterm's default color cube. These
132 '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,
133 defined colors may then be used as any of the pre-defined eight,
130 including appending '_background' to set the background to that color.
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 If no suitable authentication entry is found, the user is prompted
386 If no suitable authentication entry is found, the user is prompted
387 for credentials as usual if required by the remote.
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 ``committemplate``
417 ``committemplate``
391 ------------------
418 ------------------
@@ -1797,6 +1824,13 b' User interface controls.'
1797
1824
1798 By default, the first bundle advertised by the server is used.
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 ``commitsubrepos``
1834 ``commitsubrepos``
1801 Whether to commit modified subrepositories when committing the
1835 Whether to commit modified subrepositories when committing the
1802 parent repository. If False and one subrepository has uncommitted
1836 parent repository. If False and one subrepository has uncommitted
@@ -533,7 +533,7 b' hide outer repo'
533 -q --quiet suppress output
533 -q --quiet suppress output
534 -v --verbose enable additional output
534 -v --verbose enable additional output
535 --color TYPE when to colorize (boolean, always, auto, never, or
535 --color TYPE when to colorize (boolean, always, auto, never, or
536 debug) (EXPERIMENTAL)
536 debug)
537 --config CONFIG [+] set/override config option (use 'section.name=value')
537 --config CONFIG [+] set/override config option (use 'section.name=value')
538 --debug enable debugging output
538 --debug enable debugging output
539 --debugger start debugger
539 --debugger start debugger
@@ -572,7 +572,7 b' hide outer repo'
572 -q --quiet suppress output
572 -q --quiet suppress output
573 -v --verbose enable additional output
573 -v --verbose enable additional output
574 --color TYPE when to colorize (boolean, always, auto, never, or
574 --color TYPE when to colorize (boolean, always, auto, never, or
575 debug) (EXPERIMENTAL)
575 debug)
576 --config CONFIG [+] set/override config option (use 'section.name=value')
576 --config CONFIG [+] set/override config option (use 'section.name=value')
577 --debug enable debugging output
577 --debug enable debugging output
578 --debugger start debugger
578 --debugger start debugger
@@ -854,7 +854,7 b' extension help itself'
854 -q --quiet suppress output
854 -q --quiet suppress output
855 -v --verbose enable additional output
855 -v --verbose enable additional output
856 --color TYPE when to colorize (boolean, always, auto, never, or
856 --color TYPE when to colorize (boolean, always, auto, never, or
857 debug) (EXPERIMENTAL)
857 debug)
858 --config CONFIG [+] set/override config option (use 'section.name=value')
858 --config CONFIG [+] set/override config option (use 'section.name=value')
859 --debug enable debugging output
859 --debug enable debugging output
860 --debugger start debugger
860 --debugger start debugger
@@ -891,7 +891,7 b" Make sure that single '-v' option shows "
891 -q --quiet suppress output
891 -q --quiet suppress output
892 -v --verbose enable additional output
892 -v --verbose enable additional output
893 --color TYPE when to colorize (boolean, always, auto, never, or
893 --color TYPE when to colorize (boolean, always, auto, never, or
894 debug) (EXPERIMENTAL)
894 debug)
895 --config CONFIG [+] set/override config option (use 'section.name=value')
895 --config CONFIG [+] set/override config option (use 'section.name=value')
896 --debug enable debugging output
896 --debug enable debugging output
897 --debugger start debugger
897 --debugger start debugger
@@ -966,7 +966,7 b" help options '-v' and '-v -e' should be "
966 -q --quiet suppress output
966 -q --quiet suppress output
967 -v --verbose enable additional output
967 -v --verbose enable additional output
968 --color TYPE when to colorize (boolean, always, auto, never, or
968 --color TYPE when to colorize (boolean, always, auto, never, or
969 debug) (EXPERIMENTAL)
969 debug)
970 --config CONFIG [+] set/override config option (use 'section.name=value')
970 --config CONFIG [+] set/override config option (use 'section.name=value')
971 --debug enable debugging output
971 --debug enable debugging output
972 --debugger start debugger
972 --debugger start debugger
@@ -1002,7 +1002,7 b" help options '-v' and '-v -e' should be "
1002 -q --quiet suppress output
1002 -q --quiet suppress output
1003 -v --verbose enable additional output
1003 -v --verbose enable additional output
1004 --color TYPE when to colorize (boolean, always, auto, never, or
1004 --color TYPE when to colorize (boolean, always, auto, never, or
1005 debug) (EXPERIMENTAL)
1005 debug)
1006 --config CONFIG [+] set/override config option (use 'section.name=value')
1006 --config CONFIG [+] set/override config option (use 'section.name=value')
1007 --debug enable debugging output
1007 --debug enable debugging output
1008 --debugger start debugger
1008 --debugger start debugger
@@ -250,7 +250,6 b' Test extension help:'
250 censor erase file content at a given revision
250 censor erase file content at a given revision
251 churn command to display statistics about repository history
251 churn command to display statistics about repository history
252 clonebundles advertise pre-generated bundles to seed clones
252 clonebundles advertise pre-generated bundles to seed clones
253 color colorize output from some commands
254 convert import revisions from foreign VCS repositories into
253 convert import revisions from foreign VCS repositories into
255 Mercurial
254 Mercurial
256 eol automatically manage newlines in repository files
255 eol automatically manage newlines in repository files
@@ -317,7 +316,7 b' Test short command list with verbose opt'
317 -q --quiet suppress output
316 -q --quiet suppress output
318 -v --verbose enable additional output
317 -v --verbose enable additional output
319 --color TYPE when to colorize (boolean, always, auto, never, or
318 --color TYPE when to colorize (boolean, always, auto, never, or
320 debug) (EXPERIMENTAL)
319 debug)
321 --config CONFIG [+] set/override config option (use 'section.name=value')
320 --config CONFIG [+] set/override config option (use 'section.name=value')
322 --debug enable debugging output
321 --debug enable debugging output
323 --debugger start debugger
322 --debugger start debugger
@@ -417,7 +416,7 b' Verbose help for add'
417 -q --quiet suppress output
416 -q --quiet suppress output
418 -v --verbose enable additional output
417 -v --verbose enable additional output
419 --color TYPE when to colorize (boolean, always, auto, never, or
418 --color TYPE when to colorize (boolean, always, auto, never, or
420 debug) (EXPERIMENTAL)
419 debug)
421 --config CONFIG [+] set/override config option (use 'section.name=value')
420 --config CONFIG [+] set/override config option (use 'section.name=value')
422 --debug enable debugging output
421 --debug enable debugging output
423 --debugger start debugger
422 --debugger start debugger
@@ -2522,7 +2521,7 b' Dish up an empty repo; serve it cold.'
2522 <td>enable additional output</td></tr>
2521 <td>enable additional output</td></tr>
2523 <tr><td></td>
2522 <tr><td></td>
2524 <td>--color TYPE</td>
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 <tr><td></td>
2525 <tr><td></td>
2527 <td>--config CONFIG [+]</td>
2526 <td>--config CONFIG [+]</td>
2528 <td>set/override config option (use 'section.name=value')</td></tr>
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 <td>enable additional output</td></tr>
2722 <td>enable additional output</td></tr>
2724 <tr><td></td>
2723 <tr><td></td>
2725 <td>--color TYPE</td>
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 <tr><td></td>
2726 <tr><td></td>
2728 <td>--config CONFIG [+]</td>
2727 <td>--config CONFIG [+]</td>
2729 <td>set/override config option (use 'section.name=value')</td></tr>
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