RSS / Atom

256 colors, rxvt and gnu screen

2009-02-20 , ,

I like my color terminal and use rxvt, urxvt and on OSX iTerm with rxvt emulation but I do nearly everything inside gnu screen sessions over ssh. A quirk is that I use more than the default eight to sixteen colors for highlighting and most of the time it doesn’t work properly. The following is my work around.

First, make sure the terminal or emulator is actually reporting the correct term type. For reasons I can’t understand, it’s popular to set it by hand. This is wrong and the results vary but it works just often enough on Linux that it gets perpetuated. For my iTerm with rxvt emulation, I have:

   opal% echo $TERM

Check the local terminal for proper color output using any of several scripts, I use the one by Todd Larsen called ``, I found a copy here. It should look like this:

If that succeeded, log into the target host and confirm that it also works.

If not, it may be that the host has an outdated terminfo library. At one time Eric Raymond kept the file up to date but terminfo.src.gz is more actively maintained. You’ll need a relatively recent of version of tic, acquired from the ncurses project, to compile the src into a set of definitions. Create a new set for yourself:

   $ tic -s -x -o $HOME/share/terminfo terminfo.src

Try setting TERMINFO and retrying the above steps:

   $ TERMINFO=$HOME/share/terminfo && export TERMINFO
   $ ./


Comment [1]

2009-02-20 15:50 , Ross

It may be necessary to set TERM to the specific 256-color variety to get support, ex.

$ TERM=rxvt-256color
$ export TERM

Not sure why that\'s necessary for screen to do the right thing.

Commenting is closed for this article.