Table of Contents
256 Colors
Once upon a time, having a colored terminal displaying whole eight different colors was subject to the geeks amongst all the terminal users. Nowadays, this is nothing special anymore. Consequently, one has to go further: 256 colours!
rxvt-unicode
Compile with support for 256 colours (–enable-256-color
), then make sure
$TERM
is set correctly:
- .Xresources
URxvt.termName: rxvt-256color
Bash / Zsh
Clone dircolors-solarized.git:
# git clone https://github.com/seebi/dircolors-solarized.git
Copy one of the dircolors.* files to ~/.dir_colors and add the following to the shell's init script (if not already provided by the distribution's global one:
eval $(dircolors -b ~/.dir_colors)
Vim
Just add the following to ~/.vimrc:
- .vimrc
set t_Co=256
Optionally search for a nice colorscheme supporting 256 colors (default was fine for me).
Screen
This depends on the value of $TERM
at the time screen
is started -
rxvt-256color
is fine. Or maybe not? In doubt, one may override it:
- .screenrc
term xterm-256color
Mutt
Compile with slang support (–with-slang
). Maybe not necessary, but
certainly useful.
Mutt's colors are subject to customisation anyway, but here's a nice sample: https://github.com/altercation/mutt-colors-solarized/blob/master/mutt-colors-solarized-dark-256.muttrc
Debugging / Testing
This script is useful:
- 256-colors.sh
#!/bin/bash # This program is free software. It comes without any warranty, to # the extent permitted by applicable law. You can redistribute it # and/or modify it under the terms of the Do What The Fuck You Want # To Public License, Version 2, as published by Sam Hocevar. See # http://sam.zoy.org/wtfpl/COPYING for more details. for fgbg in 38 48 ; do #Foreground/Background for color in {0..256} ; do #Colors #Display the color echo -en "\e[${fgbg};5;${color}m ${color}\t\e[0m" #Display 10 colors per lines if [ $((($color + 1) % 10)) == 0 ] ; then echo #New line fi done echo #New line done exit 0
This one is also nice, found on Github and customized to get default parameter from tput output:
- show-ansi-colors.sh
#!/bin/bash ncolors=${1:-$(tput colors)} echo "showing $ncolors ansi colors:" for ((n = 0; n < $ncolors; n++)); do printf " [$n] $(tput setaf $n)" printf "wMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMwMw" printf "$(tput sgr0)\n" done