Getting Solarized working on Ubuntu

03 Nov 2012 in TIL

I use Solarized on everything, so when I started using Ubuntu again, not having it on there wasn't really an option. Unforunately, there's no easy way to install it on Ubuntu, it's very much left to the user to work out what's going on. I'm gonna document the process here (for Solarized dark), but if you want to read more, here are the relevant links:

Set up the Solarized palette

Run the following commands in the terminal

bash
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"

Install the correct dircolors + set to autoload

Grab a copy of the dircolours file we need

bash
curl https://raw.github.com/seebi/dircolors-solarized/master/dircolors.256dark > ~/.dircolors

Add the following to your .(bash|zsh)rc to autoload them:

bash
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
fi

Open a new terminal, and it should all be working

Add aliases to colourise everything

If after running the above commands it's still not working, make sure that ls has the colour flag set by running:

bash
ls --color .

If it changes the output, you can add the following to your .(bash|zsh)rc to force colour each time you run the command. I like -F too, as it helps classify visually what everything is:

bash
alias ls="ls -F --color"