next up previous contents
Next: Rebinding Keyboard Shortcuts Up: Advanced Customization Previous: Using Mutt with different   Contents

Configuring Colors

Colors are available to you in terminals that support them, including most Linux virtual terminals, and many terminals for the X Window system like xterm, aterm, and so on. You may want different color schemes for different circumstances though: xterms are black-on-white unless you specify otherwise, but virtual consoles are white on black. In addition, aterm, gnome-terminal, and konsole are all terminal emulators capable of using transparency and background images, both of which are very pleasant effects. So instead of committing yourself to colors in your .muttrc file it's better to put groups of colors in additional files and source them as necessary. For example, create .mutt-clear, which will be the color configuration when you use mutt in a transparent terminal, .mutt-white for black on white scenarios, and .mutt-black for white on black scenarios. Then once mutt is running you can source the one you would like to use by entering:

: source ~/.mutt-clear

Note the colon at the beginning of the line, which indicates to mutt you'd like to enter a command. Alternately, you can simply source the file in your .muttrc file by adding that line to your .muttrc. Color works as follows: You indicate which object you'd like to define a color for and its foreground and background colors, plus a regular expression if the color is to be conditional (for example, to provide color for text that looks like an email address). You can remove a color with the uncolor command, something I've never had ocassion to do. The following three lines are examples of the format, and you can then choose an object from chart 9 and a color from the following list: white, black, green, magenta, blue, cyan, yellow, red, default, colorx. The foreground color can also be prefixed with the keyword ``bright'' to make the foreground color boldfaced (e.g., brightred). If you run mutt in a clear terminal, make sure to choose `default' as your background color in order to preserve the transparency.

color object foreground background [ regexp ]
color index foreground background pattern
uncolor index pattern [ pattern ... ]

Figure 9: Parts (Objects) of Messages that can be Highlighted
\begin{figure}\begin{tabular}{l\vert l}
Name & Description \\
...underlined patterns in the body of messages \\

As usual, an example is worth its weight in gold. The following are my color selections, including some that I copied from the defaults that come along with the Debian package for mutt. In general, this provides a black background, white text, attachment labels in yellow, quoted text in green, and deleted messages in red. In addition, email addresses and URLs are highlighted in bright colors in the message body.

color normal	white black
color attachment brightyellow black
color hdrdefault cyan black
color indicator black cyan
color markers	brightred black
color quoted	green black
color signature cyan black
color status	brightgreen blue
color tilde	blue black
color tree	red black

color index	red black ~D
color index	magenta black ~T

#color header	brightgreen black ^From:
#color header	brightcyan black ^To:
#color header	brightcyan black ^Reply-To:
#color header	brightcyan black ^Cc:
#color header	brightblue black ^Subject:

color body	brightred black [\-\.+_a-zA-Z0-9]+@[\-\.a-zA-Z0-9]+
# identifies email addresses

color body	brightblue black (https?|ftp)://[\-\.,/%~_:?&=\#a-zA-Z0-9]+
# identifies URLs

Here's one way to make it useful. Let's say you receive mail at both and, and the latter account simply forwards all received mail to your account. You can different between the two types of mail in your inbox by including in your .muttrc color index green default ' C penguin'. Any mail where the word ``penguin'' appears in the to: or CC: lines will be shown as green.

next up previous contents
Next: Rebinding Keyboard Shortcuts Up: Advanced Customization Previous: Using Mutt with different   Contents
Randall Wood 2009-12-02