aboutsummaryrefslogtreecommitdiff
path: root/functions
diff options
context:
space:
mode:
authorThomas Bächler <thomas@archlinux.org>2007-10-21 10:05:28 +0200
committerThomas Bächler <thomas@archlinux.org>2007-10-21 10:05:28 +0200
commitcfab94bc71dc2e072c691122df82f4b6f2bdef29 (patch)
tree80ffd8cb7f0105c3862dfa0807466585a1fa82a9 /functions
parentbb0984ad899ab3ae85ef8bf2c0e178a2b485885c (diff)
downloadinitscripts-cfab94bc71dc2e072c691122df82f4b6f2bdef29.tar.xz
disable colors on stupid terminals
(fixes #7369)
Diffstat (limited to 'functions')
-rw-r--r--functions15
1 files changed, 14 insertions, 1 deletions
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