[PATCH] term_colors.sh: do not use colors on a dumb term

iff at escondida.tk iff at escondida.tk
Fri Feb 22 04:06:52 UTC 2019


From: Ivy Foster <iff at escondida.tk>

Signed-off-by: Ivy Foster <iff at escondida.tk>
---
Conventionally, any terminal incapable of advanced features, such as
ANSI escape code interpretation, sets $TERM to the generic value
"dumb" to indicate that no program should expect it to be anything
more complex than a teletype.

 lib/term_colors.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/term_colors.sh b/lib/term_colors.sh
index a675247..87e95ee 100644
--- a/lib/term_colors.sh
+++ b/lib/term_colors.sh
@@ -1,6 +1,6 @@
 # check if messages are to be printed using color
 unset ALL_OFF BOLD BLUE GREEN RED YELLOW
-if [[ -t 2 && ! $USE_COLOR = "n" ]]; then
+if [[ -t 2 && ! $USE_COLOR = "n" && ! $TERM = "dumb" ]]; then
 	# prefer terminal safe colored and bold text when tput is supported
 	if tput setaf 0 &>/dev/null; then
 		ALL_OFF="$(tput sgr0)"
-- 
2.20.1


More information about the pacman-contrib mailing list