Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm trying to set my xterm background color to "color 234" in xterm256 color mode, but I don't know what to pass to the "-bg" option. I've tried "color234", "Color234", but those are not defined.

share|improve this question

3 Answers 3

The bg option sets the X window background and has nothing to do with the emulation or the 256-color escape codes interpreted by the terminal.

You can find more about the escape codes that the terminal interprets at http://rtfm.etla.org/xterm/ctlseq.html .

According to the documentation, the escape sequence is:

  • ESC [ 38;5;xxxm (To set the background)
  • ESC [ 48;5;xxxm (To set the foreground)

Where xxx is the color value as follows:

  • 0-15 are the standard ANSI colors
  • 16-231 are a 6x6x6 RGB color cube given by ((36 * r) + (6 * g) + b + 16) with r,g,b in [0..5]
  • 232-255 are a greyscale ramp without black and white.

The other commenter was correct about setting the background color of the window to 0x1C1C1C with xterm -bg rgb:1c/1c/1c, as Color #234 in the 256-color Xterm emulation is a dark grey of 0x1C1C1C as computed by http://www.vim.org/scripts/script.php?script_id=1349: alt text

share|improve this answer
1  
I think you got the 38 and 48 backwards? –  retracile Dec 7 '09 at 22:06
    
dangit. And I thought I double checked. –  Joe Koberg Dec 8 '09 at 15:29

xterm -bg rgb:1c/1c/1c is how you'd set the color using RGB values.

share|improve this answer

Here is a chart of X11 color names.

You may have /etc/X11/rgb.txt on your system.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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