Terminal 24-bit color and italics

  1. Create a xterm-24bit.terminfo file in your home directory containing:
xterm-24bit|xterm with 24-bit direct color mode and italic text,
    use=xterm-256color,
    sitm=\E[3m,
    ritm=\E[23m,
    setb24=\E[48;2;%p1%{65536}%/%d;%p1%{256}%/%{255}%&%d;%p1%{255}%&%dm,
    setf24=\E[38;2;%p1%{65536}%/%d;%p1%{256}%/%{255}%&%d;%p1%{255}%&%dm,

Note: make sure to have a newline (LF) at the end of file otherwise it will error!

  1. Run the following command to compile it:
tic -x ~/xterm-24bit.terminfo
  1. Start using it by enabling it in your ~/.bash_profile:
export TERM=xterm-24bit
  1. Fix your ssh issues with:
alias ssh="TERM=xterm ssh"
  1. Generally speaking, it’s a good idea to set your language env variables to .UTF-8, so all characters display correctly:
export LC_ALL=en_GB.UTF-8
export LANG=en_GB.UTF-8
export LANGUAGE=en_GB.UTF-8
  1. To use with tmux, configure it via:
set -g default-terminal "xterm-24bit"
set -g terminal-overrides ',xterm-24bit:Tc'

Now, if only this was available by default… that would be great!