Friday, June 4, 2010

urxvt: 256 colors in ubuntu

Unfortunately Ubuntu has rxvt-unicode package without full 256 colors support.

The easiest way is to rebuild the package manually.

Following steps describe how to do that easily:

Get urxvt sources:

$ apt-get source rxvt-unicode
$ cd rxvt-unicode-9.06
Apply 256 color patch that could be already found in the package:
$ patch -p1 < doc/urxvt-8.2-256color.patch
Edit debian build rules file to reflect the changes from the patch. In debian/rules find definition of cfgcommon and replace
--with-term=rxvt-unicode
with
--with-term=rxvt-256color --enable-xterm-colors=256
Now you should checkout build dependencies and build the package:
$ sudo apt-get build-dep rxvt-unicode
$ dpkg-buildpackage -us -uc
Once the build process had been finished, install the resulting deb package:
$ sudo dpkg -i rxvt-unicode_9.06-1ubuntu0.09.10.1_i386.deb
At this point it's possible to delete build dependencies
$ sudo aptitude markauto $(apt-cache showsrc rxvt-unicode | grep Build-Depends: | sed -e 's/Build-Depends:\|,\|([^)]*)//g')
Don't forget to configure .Xresources to make use of 256 colors in urxvt. For instance mine looks like:
URxvt.termName:             rxvt-256color