doc: refactor description of color format

This is a general cleanup of the description of colors in
git-config, mostly to address inaccuracies and confusion
that had grown over time:

  - you can have many attributes, not just one

  - the discussion flip-flopped between colors and
    attributes; now we discuss everything about colors, then
    everything about attributes

  - many concepts were lumped into the first paragraph,
    making it hard to read, and especially to find the
    actual lists of colors and attributes. I stopped short
    of breaking those out into their own lists, as it seemed
    like an excessive use of vertical screen real estate.

  - we introduced negated attributes, but then the next
    paragraph basically explains how each item starts off
    with no attributes. So why would one need negated
    attributes? We now explain.

  - minor typo, language, and typography fixes

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Jeff King
2016-06-23 13:32:30 -04:00
committed by Junio C Hamano
parent 0111681ecf
commit adb3356664

View File

@ -147,27 +147,32 @@ integer::
1024", "by 1024x1024", etc. 1024", "by 1024x1024", etc.
color:: color::
The value for a variables that takes a color is a list of The value for a variable that takes a color is a list of
colors (at most two) and attributes (at most one), separated colors (at most two, one for foreground and one for background)
by spaces. The colors accepted are `normal`, `black`, and attributes (as many as you want), separated by spaces.
`red`, `green`, `yellow`, `blue`, `magenta`, `cyan` and +
`white`; the attributes are `bold`, `dim`, `ul`, `blink` and The basic colors accepted are `normal`, `black`, `red`, `green`, `yellow`,
`reverse`. The first color given is the foreground; the `blue`, `magenta`, `cyan` and `white`. The first color given is the
second is the background. The position of the attribute, if foreground; the second is the background.
any, doesn't matter. Attributes may be turned off specifically +
Colors may also be given as numbers between 0 and 255; these use ANSI
256-color mode (but note that not all terminals may support this). If
your terminal supports it, you may also specify 24-bit RGB values as
hex, like `#ff0ab3`.
+
The accepted attributes are `bold`, `dim`, `ul`, `blink`, and `reverse`.
The position of any attributes with respect to the colors (before, after,
or in between), doesn't matter. Specific attributes may be turned off
by prefixing them with `no` (e.g., `noreverse`, `noul`, etc). by prefixing them with `no` (e.g., `noreverse`, `noul`, etc).
+ +
Colors (foreground and background) may also be given as numbers between For git's pre-defined color slots, the attributes are meant to be reset
0 and 255; these use ANSI 256-color mode (but note that not all at the beginning of each item in the colored output. So setting
terminals may support this). If your terminal supports it, you may also `color.decorate.branch` to `black` will paint that branch name in a
specify 24-bit RGB values as hex, like `#ff0ab3`. plain `black`, even if the previous thing on the same output line (e.g.
+ opening parenthesis before the list of branch names in `log --decorate`
The attributes are meant to be reset at the beginning of each item output) is set to be painted with `bold` or some other attribute.
in the colored output, so setting color.decorate.branch to `black` However, custom log formats may do more complicated and layered
will paint that branch name in a plain `black`, even if the previous coloring, and the negated forms may be useful there.
thing on the same output line (e.g. opening parenthesis before the
list of branch names in `log --decorate` output) is set to be
painted with `bold` or some other attribute.
Variables Variables