aboutsummaryrefslogtreecommitdiffstats
path: root/term256.sh
blob: 43d45ce6f4474bb09abe21b0170a78caa572c806 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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