This is against http://git.fedorahosted.org/cgit/initscripts.git/ and part of https://fedoraproject.org/wiki/Features/256_Color_Terminals The scripts should work on any system though, in either system-wide or per-user profile setting. From bdd5a5e3bd11d904939bd15bcc54c8ef89ef1ed4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A1draig=20Brady?= Date: Wed, 8 Aug 2012 21:56:17 +0100 Subject: [PATCH] Enable 256 color terminals by default --- Makefile | 1 + term256.csh | 27 +++++++++++++++++++++++++++ term256.sh | 28 ++++++++++++++++++++++++++++ 3 files changed, 56 insertions(+), 0 deletions(-) create mode 100644 term256.csh create mode 100644 term256.sh diff --git a/Makefile b/Makefile index c209bef..8f3b664 100644 --- a/Makefile +++ b/Makefile @@ -24,6 +24,7 @@ install: install -m644 rwtab statetab networks $(ROOT)/etc install -m755 service setsysfont $(ROOT)/sbin install -m644 lang.csh lang.sh $(ROOT)/etc/profile.d + install -m644 term256.csh term256.sh $(ROOT)/etc/profile.d install -m644 debug.csh debug.sh $(ROOT)/etc/profile.d install -m755 sys-unconfig $(ROOT)/usr/sbin install -m644 service.8 sys-unconfig.8 $(ROOT)$(mandir)/man8 diff --git a/term256.csh b/term256.csh new file mode 100644 index 0000000..1197512 --- /dev/null +++ b/term256.csh @@ -0,0 +1,27 @@ +# 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) +set local256="$?COLORTERM$?XTERM_VERSION$?ROXTERM_ID$?KONSOLE_DBUS_SESSION" + +if ($?TERM && ($local256 || $?SEND_256_COLORS_TO_REMOTE)) then + + switch ($TERM) + case 'xterm': + case 'screen': + case 'Eterm': + setenv TERM "$TERM-256color" + endsw + + if ($?TERMCAP && ($TERM == "screen-256color")) then + setenv TERMCAP `echo "$TERMCAP" | sed -e 's/Co#8/Co#256/g'` + endif +endif + +unset local256 diff --git a/term256.sh b/term256.sh new file mode 100644 index 0000000..43d45ce --- /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 -- 1.7.6.4