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

Message ID 20190222040652.5058-1-iff@escondida.tk
State Accepted, archived
Headers show
Series term_colors.sh: do not use colors on a dumb term | expand

Commit Message

Ivy Foster Feb. 22, 2019, 4:06 a.m. UTC
From: Ivy Foster <iff@escondida.tk>

Signed-off-by: Ivy Foster <iff@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(-)

Patch

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)"