Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Estelle <robertestelle@gmail.com>2021-10-26 01:32:36 +0300
committerJunio C Hamano <gitster@pobox.com>2021-10-28 19:37:08 +0300
commit05f1f41c9b02b916a5f03c5658bec3270ac3684d (patch)
tree1f56c22fefc92aca90f426a61c7505a144a05976 /t/t4026-color.sh
parentaeefc1866c7f98ac76aac66b92cc142b8135054e (diff)
color: support "default" to restore fg/bg color
The name "default" can now be used in foreground or background colors, and means to use the terminal's default color, discarding any explicitly-set color without affecting the other attributes. On many modern terminals, this is *not* the same as specifying "white" or "black". Although attributes could previously be cleared like "no-bold", there had not been a similar mechanism available for colors, other than a full "reset", which cannot currently be combined with other settings. Note that this is *not* the same as the existing name "normal", which is a no-op placeholder to permit setting the background without changing the foreground. (i.e. what is currently called "normal" might have been more descriptively named "inherit", "none", "pass" or similar). Signed-off-by: Robert Estelle <robertestelle@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t4026-color.sh')
-rwxr-xr-xt/t4026-color.sh12
1 files changed, 12 insertions, 0 deletions
diff --git a/t/t4026-color.sh b/t/t4026-color.sh
index cc73161b46..d6907a66c3 100755
--- a/t/t4026-color.sh
+++ b/t/t4026-color.sh
@@ -96,6 +96,18 @@ test_expect_success '24-bit colors' '
color "#ff00ff black" "[38;2;255;0;255;40m"
'
+test_expect_success '"default" foreground' '
+ color "default" "[39m"
+'
+
+test_expect_success '"normal default" to clear background' '
+ color "normal default" "[49m"
+'
+
+test_expect_success '"default" can be combined with attributes' '
+ color "default default no-reverse bold" "[1;27;39;49m"
+'
+
test_expect_success '"normal" yields no color at all"' '
color "normal black" "[40m"
'