emacs equivalent of vim's bg=dark? (setting background to dark)

Viewed 16363

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?

5 Answers

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

(invert-face 'default)

Or:

M-x invert-face <RET> default

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.

Write this at the end of your ~/.emacs file :

;; dark mode
(when (display-graphic-p)
  (invert-face 'default)
)
(set-variable 'frame-background-mode 'dark)

Note: The "when" sentence is there to avoid to invert colors in no-window mode (I presume your terminal has already a black background).

Related