aboutsummaryrefslogtreecommitdiffstats
path: root/term256.sh
diff options
context:
space:
mode:
authorPádraig Brady <pbrady@redhat.com>2012-08-08 21:56:17 +0100
committerBill Nottingham <notting@redhat.com>2012-09-14 15:59:19 -0400
commit8d627ea4b403a8c291b3b26e5bf42af147da8717 (patch)
treecaef99d1989b66fa94e30bdaa1a64ecaf60f810b /term256.sh
parent02ca71f53ca1fe26a416b20a8a6b392565f74b57 (diff)
downloadinitscripts-8d627ea4b403a8c291b3b26e5bf42af147da8717.tar
initscripts-8d627ea4b403a8c291b3b26e5bf42af147da8717.tar.gz
initscripts-8d627ea4b403a8c291b3b26e5bf42af147da8717.tar.bz2
initscripts-8d627ea4b403a8c291b3b26e5bf42af147da8717.tar.xz
initscripts-8d627ea4b403a8c291b3b26e5bf42af147da8717.zip
Enable 256 color terminals by default
Diffstat (limited to 'term256.sh')
-rw-r--r--term256.sh28
1 files changed, 28 insertions, 0 deletions
diff --git a/term256.sh b/term256.sh
new file mode 100644
index 00000000..43d45ce6
--- /dev/null
+++ b/term256.sh
@@ -0,0 +1,28 @@
+# Enable 256 color capabilities for appropriate terminals
+
+# Uncomment this if you want remote xterms connecting
+# to this system, to be sent 256 colors. Note that
+# local xterms, ssh'ing to localhost are considered
+# remote in this context, but in that case, $TERM should
+# have already been set to 256 color capable.
+# SEND_256_COLORS_TO_REMOTE=1
+
+# Terminals with any of the following set, support 256 colors (and are local)
+local256="$COLORTERM$XTERM_VERSION$ROXTERM_ID$KONSOLE_DBUS_SESSION"
+
+if [ -n "$local256" ] || [ -n "$SEND_256_COLORS_TO_REMOTE" ]; then
+
+ case "$TERM" in
+ 'xterm') TERM=xterm-256color;;
+ 'screen') TERM=screen-256color;;
+ 'Eterm') TERM=Eterm-256color;;
+ esac
+ export TERM
+
+ if [ -n "$TERMCAP" ] && [ "$TERM" = "screen-256color" ]; then
+ TERMCAP=$(echo "$TERMCAP" | sed -e 's/Co#8/Co#256/g')
+ export TERMCAP
+ fi
+fi
+
+unset local256