tags:

views:

194

answers:

3

In vim, I can run set bg=dark and then vim will adjust all syntax highlighting to work on a terminal with a dark background (whether or not the background actually is dark, vim will assume that it is).

How do I tell emacs to assume that the background is either dark or light?

+1  A: 

M-x set-variable <RET> frame-background-mode <RET> dark

see also the bottom of http://www.gnu.org/software/emacs/elisp/html_node/Defining-Faces.html

Thr4wn
Setting the variable `frame-background-mode` doesn't actually change what's currently displayed in your frame, at least not for me.Also, for that to work, it should be `M-x` instead of `M-:`. If you do `M-:`, then you need this:`M-: (set-variable 'frame-background-mode 'dark)`
pheaver
A: 

I've used the invert-face function in the past:

(invert-face 'default)

Or:

M-x invert-face <RET> default

pheaver
Oh, I goofed. `invert-face` does not change `frame-background-mode`. So, you'll need to also do what Thr4wn suggested.
pheaver
Ah, one more thing... If you set `frame-background-mode` to nil, then it will be adjusted automatically based on the face. This is what I use :).
pheaver
+2  A: 

Hi,

I think the best approach to use is to use ColorTheme. Other options to customize the frame colors you can find here. I can't think about a single command, however you can start emacs with --reverse-video.

danielpoe