I am looking for a way to force "emacs -nw" to use the same background color that the terminal uses. (just like vim does). By default, every emacs theme has its own default background color. Whiteboard mode has white that is not the same white as my terminal.

2 Answers 2


It seems that setting the background color of the default font to an undefined value turns off any customization. This feels like a hack, and there might be a better way to do this, but this worked for me:

;; init.el
(set-face-background 'default "undefined")

Of course, if "undefined" will ever be defined (haha) in the color palette, this will break.

  • that worked, thank you Mar 25, 2020 at 6:16

You can also use custom-set-faces to just NOT set properties when using a tty, and then have other defaults for other types.

With the following, the default face gets foreground and background set unless the display type is tty, as it is when you run emacs -nw.

For some other things, I generally like the defaults, especially when using X11. I override a handful of those when type is tty, and leave them alone otherwise.

Note that the comment-face is always set ... brightgreen for terminals, green1 otherwise (X11).

 ;; 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 ((((type tty)))
            (t (:background "#6F4700" :foreground "yellow" :slant normal :weight normal :width normal :foundry "default" :family "monospace"))))
 '(font-lock-comment-face ((((type tty)) (:foreground "brightgreen"))
                           (t (:foreground "green1"))))
 '(font-lock-builtin-face ((((type tty)) (:foreground "color-250"))))
 '(minibuffer-prompt ((((type tty)) (:foreground "cyan"))))
 '(font-lock-string-face ((((type tty)) (:foreground "orange")))))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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