mirror of
https://github.com/git/git.git
synced 2026-01-10 01:56:42 +00:00
color: allow colors to be prefixed with "reset"
"reset" was previously treated as a standalone special color name representing `\e[m`. Now, it can apply to other color properties, allowing exact specifications without implicit attribute inheritance. For example, "reset green" now renders `\e[;32m`, which is interpreted as "reset everything; then set foreground to green". This means the background and other attributes are also reset to their defaults. Previously, this was impossible to represent in a single color: "reset" could be specified alone, or a color with attributes, but some thing like clearing a background color were impossible. There is a separate change that introduces the "default" color name to assist with that, but even then, the above could only to be represented by explicitly disabling each of the attributes: green default no-bold no-dim no-italic no-ul no-blink no-reverse no-strike Signed-off-by: Robert Estelle <robertestelle@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
05f1f41c9b
commit
de658515ae
1
color.h
1
color.h
@@ -6,6 +6,7 @@ struct strbuf;
|
||||
/*
|
||||
* The maximum length of ANSI color sequence we would generate:
|
||||
* - leading ESC '[' 2
|
||||
* - reset ';' .................1
|
||||
* - attr + ';' 2 * num_attr (e.g. "1;")
|
||||
* - no-attr + ';' 3 * num_attr (e.g. "22;")
|
||||
* - fg color + ';' 17 (e.g. "38;2;255;255;255;")
|
||||
|
||||
Reference in New Issue
Block a user