title: Terminal colors for tmux, vim, and weechat tags: terminal, command line, vim, tmux, solarized date: 13 Mar 2013 13:26 AST image: htop.png
Solarized is a color scheme for... well, everything, really. Users have ported it to websites, terminal programs, and even windows and Linux GUI applications. It seems to mostly be focused around text editing though, and for that I am grateful. While the command prompt in Linux tends to offer an acceptable default color palette but it's generally not the prettiest. Solarized is a great method to fix this and still maintain consistency across all your terminal applications.
First up is to set our terminal colors to the solarized template, that way all programs will generally match it. Note that this isn't a total transformation, as solarized can cause some programs to use odd color combinations, but for most it will work just fine. We will cover more specific cases later. You may only have gnome-terminal installed, and that's ok. Install the colors for it and skip to the 256 Color Support section
If you are using gnome-terminal, the default Ubuntu terminal emulator, then you will need to run the following to set the colors to the solarized versions. Just copy it all and paste it in to a gnome-terminal window:
$ gconftool-2 --set "/apps/gnome-terminal/profiles/Default/use_theme_background" \
--type bool false
$ gconftool-2 --set "/apps/gnome-terminal/profiles/Default/use_theme_colors" \
--type bool false
$ gconftool-2 --set "/apps/gnome-terminal/profiles/Default/palette" \
--type string "#070736364242:#D3D301010202:#858599990000:#B5B589890000: \
#26268B8BD2D2:#D3D336368282:#2A2AA1A19898:#EEEEE8E8D5D5:#00002B2B3636: \
#CBCB4B4B1616:#58586E6E7575:#65657B7B8383:#838394949696:#6C6C7171C4C4: \
#9393A1A1A1A1:#FDFDF6F6E3E3"
$ gconftool-2 --set "/apps/gnome-terminal/profiles/Default/background_color" \
--type string "#00002B2B3636"
$ gconftool-2 --set "/apps/gnome-terminal/profiles/Default/foreground_color" \
--type string "#65657B7B8383"
That will instantly update all the colors gnome-terminal uses to be those of solarized.
I personally use xfce4-terminal as gnome-terminal doesn't send vim-friendly alt key characters and I try to avoid running gnome applications in xfce if I can. Fortunately setting up solarized is just as easy here. First we need to download the appropriate xfce colors:
$ git clone https://github.com/sgerrand/xfce4-terminal-colors-solarized
$ cd xfce4-terminal-colors-solarized $ mv dark/terminalrc ~/.config/Terminal/
Exit and restart xfce4-terminal and you should be good. Note that any custom settings you had made before will be gone now, so go back and reset them. It's a simple program though so besides color theres not much that could have changed.
If you use any programs that set their colors based on your X-windows settings, then you'll want to do this. An example is if you were to use rxvt-unicode or some other terminal application. Most users probably wont need this, but since my blog is my notes, here it is:
$ git clone https://github.com/solarized/xresources
$ cp xresources/solarized ~/.Xresources
$ xrdb -merge ~/.Xresources
In order to get full 256 color support, you are going to want to install ncurses-term. In Ubuntu just run the following commands to install it and add some code to you ~/.bashrc to set the correct enviroment variables:
$ sudo apt-get install ncurses-term`
$ echo "case \$COLORTERM in
Terminal) TERM=xterm-256color ;;
gnome-terminal) TERM=xterm-256color ;;
esac" >> ~/.bashrc
Now that you have your new colors set up, you might have been wondering why a
command like ls
that usually returns nicely colored lists isn't looking so
hot. To fix that we are going to install a solarized color set for
ls:
$ git clone https://github.com/seebi/dircolors-solarized
$ cp dircolors-solarized/dircolors.ansi-dark ~/.dircolors
$ echo "eval \`dircolors ~/.dircolors\`" >> ~/.bashrc
Tmux is a means to maximize your screen space when using terminal applications as well as keep things alive if your connection to a remote server dies. It's a very powerful and useful program deserving it's own dedicated post, so for now I'm just going to tell you how to make it pretty using these files.
$ git clone https://github.com/seebi/tmux-colors-solarized
$ cp tmux-colors-solarized/tmuxcolors-dark.conf ~/.tmux.colors
$ echo "source ~/.tmux.colors" >> ~/.tmux.conf
$ echo set -g default-terminal \"screen-256color\" >> .tmux.conf
Vim is another great terminal program, this time for editing files. Think of it like notepad but way more powerful and, once you learn how to use it, much faster. We are going with the simple install here, although you could also set it up with Pathogen:
$ echo "
syntax enable
if has('gui_running')
set background=light
else
set background=dark
endif
set t_Co=16
let g:solarized_termcolors=16
colorscheme solarized " >> ~/.vimrc
Weechat is a newer IRC client that is open source and regularly updated. I used to be a pretty big fan of irssi until I found weechat and haven't looked back since moving on. The nice thing about weechat is that its default theme works almost perfectly out of the box with solarized. We just need to make a few tweaks to make things a bit more visible:
/set weechat.bar.status.color_bg 0
/set weechat.bar.title.color_bg 0
/set weechat.color.chat_nick_colors 1,2,3,4,5,6
/set buffers.color.hotlist_message_fg 7
/set buffers.color.hotlist_highlight_bg default
/set buffers.color.hotlist_highlight_fg 5
/set weechat.color.chat_highlight _5
Odd weechat-related question - do you know what
/set weechat.bar.buffers.items buffers
does/means?