[PATCH 1 of 3] color: document that labels are used for colourising text

Jordi Gutiérrez Hermoso jordigh at octave.org
Wed Sep 3 08:39:06 CDT 2014


# HG changeset patch
# User Jordi Gutiérrez Hermoso <jordigh at octave.org>
# Date 1408916136 14400
#      Sun Aug 24 17:35:36 2014 -0400
# Node ID c1b3584876e7a2e3001ce1324adde0fb94d23804
# Parent  e3045cd4dc22cbd9cbf0c3a22756b4e409d54627
color: document that labels are used for colourising text

It is a deeply hidden secret that it's possible to colorise so many
things with so many different labels. This is an attempt to document
this. The text is a bit long, but it seems as short as can be while
documenting everything. Perhaps it should be hidden under a --verbose
option.

diff --git a/hgext/color.py b/hgext/color.py
--- a/hgext/color.py
+++ b/hgext/color.py
@@ -19,7 +19,16 @@ terminal codes used to change color and 
 available, then effects are rendered with the ECMA-48 SGR control
 function (aka ANSI escape codes).
 
-Default effects may be overridden from your configuration file::
+Text receives color effects depending on the labels that it has. Many
+default Mercurial commands emit labelled text. You can also define
+your own labels in templates using the label function, see :hg:`help
+templates`. A single portion of text may have more than one label. In
+that case, effects given to the last label will override any other
+effects. This includes the special "none" effect, which nullifies
+other effects.
+
+The following are the default effects for some default labels. Default
+effects may be overridden from your configuration file::
 
   [color]
   status.modified = blue bold underline red_background


More information about the Mercurial-devel mailing list