I've been using Arch Linux on my new laptop and I'm trying to configure it such that I don't have any need for a DE or X server -- I just want command line utilities and a VC (productivity and saving me from myself, all that). Anyways, I'm trying to get terminal colors working right. I haven't decided between xterm and urxvt -- honestly, whichever I can get this working with is probably the one I'll end up using, at least until I understand the issue better.

Essentially, my setup (as I understand it, so take with salt) is that on VC1 I have an xterm/urxvt 16 color terminal emulator running (also, I use Zsh, if it matters). I use Tmux for multiplexing, so both my .zshrc and .tmux.conf files in ~/ have lines that set the default terminal to (xterm/rxvt)-16color.

If I launch emacs either directly in the terminal or within Tmux and run M-x list-colors-display, it shows 16 color names. The first eight are the regular ones and they're colored correctly. However, colors 9-16 are the brights and they show up as white text on black background with no colors assigned to them.

I'm under the impression that .Xresources is where color settings go, of the form *color0: #353535 and such. All 16 colors are listed there, with values I'd like them to have. However, the eight that are colored aren't even in the right hues - they are in the striking, high-contrast color that they default to, not the more mellow theme I've downloaded for testing.

I read that you need to run xrdb -merge ~/.Xresources to make these settings come into play. However, I don't have xrdb and when I installed it I got a 'display not found' error (unsurprisingly) so I removed it.

The question then, finally, is this: what do I do to make xterm/rxvt know to (a) display all 16 colors (since I'm pretty sure the brights also have defaults, so it seems something is wrong there) and (b) to use the color (and other) settings I give it in .Xresources (or elsewhere, if applicable) without using xrdb.

Thanks for any insight!

  • What are DE and VC? – RedGrittyBrick Dec 7 '11 at 11:44
  • Sorry. DE=Desktop Environment (e.g. GNOME, KDE, etc.) and VC=Virtual Console (VC1 through (usually) 7 are the terminals you see when you press ALT+F1 through ALT+F7, so VC1 is the first (and default, without X running) virtual console). – jake-low Dec 7 '11 at 21:54

If you are using console, not an X-server, the colour settings are not controlled by ~/.Xresources. For command-line and curses apps, it is the value of $TERM and the corresponding entries in termcap and terminfo which determine how colours are displayed.

Tmux may complicate things, I haven't tried it so can't advise. I would get things working right without it first.

  • Followup: I found some useful info about the terminfo database, but I'm confused because when I open one (/usr/share/terminfo/*/*) in emacs it appears as gibberish. Maybe that's how it's supposed to look, but it's unreadable by humans. Any idea why? – jake-low Dec 7 '11 at 22:20
  • 1
    @andhrimnir: Unlike termcap, the terminfo database is a binary format, not a text format. You can decode it to text and you can compile a text form to produce binary terminfo file. See man infocmp, man tic, man terminfo. Try infocmp ansi and look for colors#8, setf=\E[3%p1%dm, setb=\E[4%p1%dm – RedGrittyBrick Dec 8 '11 at 10:06

Running in a Linux console (no X), setting TERM to xterm (any flavor) or rxvt (any flavor) will not give good results. The linux terminal description is the most often used.

Compare those with infocmp, e.g.,

infocmp xterm linux

and you will see a number of differences.

One aspect of the "bright colors" is not apparent in the terminal description: the Linux console displays bold text as brighter text. Some people are confused by this, and refer to the bold+color combinations as additional colors (they are not, because the application asked for bold, which is a video attribute such as underlining — which some devices may also render as a color).

xterm has control sequences for manipulating 16 colors as such; the Linux console does not. The variations of TERM which were tried were not specified, but supposing that one tried xterm-16color, then that would produce escape sequences for "colors 8-15" which are not recognized by the Linux console, and would produce the white-on-black (uncolored) which was described.

If you run a program which makes bold text on some other type of terminal, you are just as likely to get bold rendered in in a different way (like this).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.