Set urxvt to work with 256 colors

colorsrxvturxvtxterm

I had spent so much time to try to get urxvt to work with 256 colors. I am using Ubuntu. I have followed a part of this post

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

tput colors gives 256 now instead of 88 earlier
But when I run the 256colors2.pl script, the output is not as expected.
Here is the screenshot

echo $TERM gives rxvt-unicode as output in urxvt.

echo $COLORTERM gives rxvt-xpm as output in vim.

echo &t_Co gives 256 as output in vim.

Please help me figure out how to set up 256 colors for urxvt. My main aim is to use vim(in terminal) with the gruvbox theme.

Response for an answer:

I have already set the t_Co=256 option in vim. I don't use tmux. Using it doesn't change the result of the 256colors2.pl script. The TERM in tmux is already set to screen-256color. I tried copying the /usr/share/terminfo/r/rxvt-256color to ~/.terminfo/r/rxvt-256color. No change on TERM or the results of the tests. Finally I used the colortest CJD14 has linked, many colors are not working. Only a bunch of colors are being coloured. So something is definitely broken or configured wrong.

Best Answer

Yes, finally found my mistake. It seems like you need to install the package rxvt-unicode-256color to get 256 color support.

sudo apt-get install rxvt-unicode-256color

is the answer to my problems.