views:

2390

answers:

5

I'm using emacs in a console window both on my local Linux box and on the login node of a remote cluster. I use emacs regularly, and I've got the foreground color set to white in my .emacs file like so:

(set-foreground-color "white")
(set-background-color "black")

However, when I run emacs, the foreground isn't white; it's grey and very hard to read. On my Mac, emacs in a console window with the same settings shows up as proper white. But on both linux boxes, in konsole and xterm, it's grey.

In case it matters, I've got TERM set to xterm-color, the desktop is running RHEL 5, and the cluster node is running RHEL 4 (CentOS).

Is this some default with how Linux sets up terminal colors? How do I get white to be white?

Note: this is with console emacs, not emacs under X. That's emacs -nw if you have DISPLAY set.

+1  A: 

Looks like you're only setting the foreground color.

(set-foreground-color "white")
(set-foreground-color "black")

I'm sure you meant set-background-color on the latter.

I can confirm this when running Emacs as:

$ emacs -nw -bg black -fg white

too.

ashawley
sorry that was a typo! Updated above.
tgamblin
This should not have been down-voted. It was a response based on the OPs typo'd question.
Sean Bright
Thanks for the defense.
ashawley
+2  A: 

What about:

(set-foreground-color "brightwhite")

In response to comment:

Within emacs, run M-x list-colors-display which should show you all of the colors that emacs thinks are available with your terminal.

Sean Bright
Does this work for you? I tried it, but it gives me black menus and status bars, and the text is shown as the default foreground color from my terminal (which is green). Maybe I don't have "brightwhite"
tgamblin
Response updated
Sean Bright
+1  A: 

I did some experiments, and you can set console colors in emacs, but you are limited to this palette:

black                    blue                                         
cyan                     green                                        
magenta                  red                                          
white                    yellow

The white that you get is somewhat grayed out; full bright white is reserved for bold text. So if you run

M-x facemenu-set-bold

you will get bold (bright white) text for later insertions.

I had no luck trying to force the default face to bold. (I don't really understand how faces work in emacs.)

Norman Ramsey
"but you are limited to this palette" - This is not really true, emacs supports 256 colors assuming your terminal is properly setup. See screenshot @ http://seanbright.com/e256.png
Sean Bright
@Sean: pick up some reputation at http://stackoverflow.com/questions/684424/how-do-i-set-up-my-linux-x-terminal-so-that-emacs-has-access-to-256-colors
Norman Ramsey
+1  A: 

What if you just used reverse-video for the console version is that good enough?

$ emacs -nw -rv
ashawley
+4  A: 

The color brightwhite looks ok on my Emacs (which is running under a terminal, not X). On RHEL5 I have my TERM environment variable set to xterm-256color. If it's working correctly, you should be able to run these scripts and see 256-color output. Under Emacs, you should see a reasonably smooth color ramp (no obviously duplicated colors) when you do M-x list-colors-display. If not, you are probably missing the right termcap entry (try installing the libtermcap-devel package, I think).

If I change TERM to xterm-color, then brightwhite comes out a bit gray in the output of list-colors-display.

I'm not sure about RHEL4.

Jacob Gabrielson