Get rxvt-unicode with 256 color support on Ubuntu
rxvt-unicode (commonly called urxvt) already has 88 color support, and for most things, this is fine. But sometimes you just want a tad more, maybe for vim color themes.
So here’s my build log of compiling rxvt-unicode with the 256 color patch on Ubuntu Hardy, and debianizing (packaging) it.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# I keep all custom deb's here, use any directory you want cd ~/debian-src # Make a place for rxvt-unicode mkdir rxvt-unicode cd rxvt-unicode/ # Get the source apt-get source rxvt-unicode cd rxvt-unicode-8.4/ # Apply 256 color patch, it's included with the source patch -p1 < doc/urxvt-8.2-256color.patch # Make sure you have all depdencies to build it sudo apt-get build-dep rxvt-unicode # Build it dpkg-buildpackage -us -uc -rfakeroot |
This will actually build three separate packages:
- rxvt-unicode
- rxvt-unicode-lite
- rxvt-unicode-ml
All I care about is rxvt-unicode, but you might want -lite or -ml. If someone more adept in Debian package building than I am can tell me how to just compile one of these versions, that’d be great. :)
Moving along:
1 2 3 4 5 6 |
# Install it! cd ~/debian-src/rxvt-unicode sudo dpkg -i rxvt-unicode_8.4-1_amd64.deb # As always, your arch may be different. Replace amd64 with whatever is # appropriate for you. |
Now we need to make terminfo aware that rxvt-unicode supports 256 colors. The default terminfo entry you’ll have for rxvt-unicode will say 88, and that won’t be right for your new version.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
cd ~ infocmp -L rxvt-unicode > rxvt-unicode.terminfo vi rxvt-unicode.terminfo # Change the following from: # # lines_of_memory#0, max_colors#88, max_pairs#256, # # to: # # lines_of_memory#0, max_colors#256, max_pairs#32767 # Make .terminfo dir if you don't already have it install -d .terminfo # Rebuild terminfo for rxvt-unicode tic -o .terminfo/ rxvt-unicode.terminfo # Cleanup rm rxvt-unicode.terminfo |
That should do it.
To test it out, use this 256colors script (you must right click and Save Link As in order to access the file). Download it, set it executable, open a fresh urxvt terminal, and run:
|
|
$ ./256colors or perl 256colors |
The output should look like:
Any program that supports 256 colors that had to fallback to 88 or even 8 colors can now be used in all its glory.









Even with a right-click “Save Link As…”, I get a 404.
Fixed. Apologies. I’m fighting my webhost not liking to host up perl files and wordpress thinking it knows best and re-writing my links.