Emacs/xterm color annoyance on Linux
Asked Answered
H

6

9

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.

Herzig answered 24/3, 2009 at 22:55 Comment(0)
G
11

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.

Grogram answered 25/3, 2009 at 0:28 Comment(0)
C
2

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.

Charpentier answered 24/3, 2009 at 23:39 Comment(1)
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"Herzig
W
2

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.)

Wicker answered 25/3, 2009 at 0:17 Comment(2)
"but you are limited to this palette" - This is not really true, emacs supports 256 colors assuming your terminal is properly setup. See screenshot @ seanbright.com/e256.pngCharpentier
@Sean: pick up some reputation at #684924Wicker
W
2

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

$ emacs -nw -rv
Woollen answered 25/3, 2009 at 0:27 Comment(0)
W
1

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.

Woollen answered 24/3, 2009 at 23:4 Comment(2)
sorry that was a typo! Updated above.Herzig
This should not have been down-voted. It was a response based on the OPs typo'd question.Charpentier
S
1

I also found that I had weird colors in terminal mode and finally traced it down to a font face customization. I had something like this:

(custom-set-faces
 ;; custom-set-faces was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(default ((t (:inherit nil :stipple nil :background "#000a00" :foreground "#ffffed" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :height 113 :width normal :foundry "unknown" :family "Droid Sans Mono")))))

I removed the foreground and background properties and everything started looking hunky-dory.

Stultify answered 5/9, 2013 at 16:28 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.