From cfab94bc71dc2e072c691122df82f4b6f2bdef29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20B=C3=A4chler?= Date: Sun, 21 Oct 2007 10:05:28 +0200 Subject: disable colors on stupid terminals (fixes #7369) --- functions | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'functions') diff --git a/functions b/functions index 961f376..acbea4d 100644 --- a/functions +++ b/functions @@ -19,8 +19,21 @@ fi # we use 13 characters for our own stuff STAT_COL=$[$STAT_COL - 13] -# colors: +# disable colors on broken terminals +TERM_COLORS="$(tput colors 2>/dev/null)" +if [ -n "${TERM_COLORS}" ]; then + case "${TERM_COLORS}" in + *[!0-9]*) + USECOLOR="" + ;; + *) + [ "${TERM_COLORS}" -lt 8 ] && USECOLOR="" + ;; + esac +fi +unset TERM_COLORS +# colors: if [ "$USECOLOR" = "YES" -o "$USECOLOR" = "yes" ]; then C_MAIN="\033[1;37m" # main text C_OTHER="\033[1;34m" # prefix & brackets -- cgit v1.2.3