Getting Solarized working on Ubuntu

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:

  • http://www.xorcode.com/2011/04/11/solarized-vim-eclipse-ubuntu/
  • https://github.com/seebi/dircolors-solarized
  • http://askubuntu.com/questions/177600/right-way-to-colorize-ls

Set up the Solarized palette

Run the following commands in the terminal

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

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

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

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:

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:

alias ls="ls -F --color"

Michael is a polyglot software engineer, committed to reducing complexity in systems and making them more predictable. Working with a variety of languages and tools, he shares his technical expertise to audiences all around the world at user groups and conferences. You can follow @mheap on Twitter

Thoughts on this post

Joshua Gomez 2013-01-29

Excellent work. Thanks!

liquid06 2013-03-11

Wow – thanks!

James 2013-03-31

Hmm, I am getting errors when running the following command from zshrc:

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

The errors are:
.dircolors: 90, 94 103, unrecognized keyword RESET, MULTIHARDLINK and CAPABILITY

This is the latest version of zsh, when ssh -X connecting to a remote shell on an non-Ubuntu OS (it didn’t complain on my local terminal though)

michael 2013-03-31

It sounds like the remote version of coreutils is out of date. Take a look at http://michaelheap.com/installing-coreutils-on-centos-5-7/ for how I fixed that issue

Peter 2013-05-24

Brilliant. Thanks!

Omar Trejo 2013-07-11

This is great! Thank you!

Leave a comment?

Leave a Reply