Skip to navigation

Getting 256 color support working for mutt in xfce4-terminal

Mutt supports 256 colors if you terminal does, and that in turn seems to depend both on the terminal and on ncurses.

For me, using Xfce on Xubuntu Gutsy, running mutt in a xfce4-terminal, 256 color support didn’t work out of the box. Putting any colorN into the ~/.muttrc yielded a “colour not supported by term” hiccup during mutt startup, and mutt just displayed the relevant item in white (the default fg color). It is also possible to find out how many colors a terminal supports with tput colors, and for me, this showed “8”.

To solve the problem:

sudo aptitude install ncurses-term

Additionally, I had to change the xfce4-terminal preferences. In the “Advanced” tab, in the field for “$TERM setting:”, change the name to xterm-256color


$ tput colors

And mutt now supports lines such as

color   index       color214  default   ~O

in the ~/.muttrc.

BTW, default as the background color makes mutt use the transparent terminal background, if you have one.


If you want to set up mutt to use some of those pretty 256 colors, you probably want to see a palette relating the numbers to the colors. At least I did, and I didn’t see a very easy way to do this at first, but I found one here. Specifically, download this perl script and execute it in your terminal to show a palette of colors relating each to its number. Pick the numbers you like and translate their number N to colorN in your ~/.muttrc where you normally would use one of the named colors.

Addendum 2

Changing the $TERM setting to “xterm-256color” caused two problems, both of which you can work around:

  • When I ssh into some remote servers, some apps have problems and say something about “xterm-256color not defined.”. I’ve put in an alias into my .bashrc for these servers to do export TERM=xterm && ssh SERVERNAME.
  • Mutt did not recognize the backspace key anymore in the index and pager (I had set a “bind” and a “macro”. Thanks to Kyle on the mutt-users mailing list, I learned to find the information with
    $ infocmp -1 -L xterm-256color | grep key_backspace
    $ infocmp -1 -L xterm | grep key_backspace

    … and then I just changed <backspace> to \177 in the .muttrc, and now it works.

3 Responses to “Getting 256 color support working for mutt in xfce4-terminal”

  1. sl Says:

    Thanks a lot!

  2. Thomas Hunter II Says:

    Setting the xfce terminal to xterm-256colors breaks all sorts of things (backspace = tab, enter = nothing), and displays this error when I run a new session:

    *** VTE ***: Failed to load terminal capabilities from ‘/etc/termcap’

  3. Marianne Says:

    @2 That’s strange. Make sure you don’t have a typo, it is “xterm-256color”, not “xterm-256colors”. I’m on xfce4-terminal 0.4.8 (Xfce 4.8) and xterm-256colors doesn’t break anything. I did have to set it by using “export TERM=xterm-256color” in the ~/.bashrc, the setting in the terminal preferences GUI didn’t have any effect.