I'm using a dark theme to write Clojure, with rainbow parentheses etc.

I like this theme and its syntax colouring, and I don't want to change it or mess it up.

BUT ... I'm currently sitting outside in a place with lots of sunlight and I can't read the screen.

What I'd like to be able to do is quickly, and temporarily (just in this session) invert the main colours : switch to a white background and black text (the other syntax colours I'm happy to keep the same)

Is there a way to do this?

  • 1
    Does this answer your question? Emacs Blue color too dark
    – NickD
    Commented Sep 1, 2020 at 17:07
  • ... and look for the accepted answer, not the highest-voted one (although you should read that one too :-))
    – NickD
    Commented Sep 1, 2020 at 17:11
  • Would it work for changing the background colour?
    – interstar
    Commented Sep 1, 2020 at 18:39
  • No, frame-background-mode tells emacs whether your background is dark or light, so that it can adjust all the other colors to make them visible against the background you have.
    – NickD
    Commented Sep 1, 2020 at 19:06
  • OK - now I see I misread the question: you want to switch the background and keep everything else the same. But try it in any case, and see if it makes things readable.
    – NickD
    Commented Sep 1, 2020 at 19:09

1 Answer 1


Answering the question in your title, if you don't like the colors of a particular part of the text, you put the cursor there, press C-u C-x =, and find the face name:

Knowing the face name you can change the foreground (M-x set-face-foreground), the background (M-x set-face-background) or any other attribute (set-face-attribute):

(set-face-attribute 'package-name nil :weight 'bold)

Replace package-name with the desired face name. nil means "for existing and newly created frames."

About foreground and background of the current frame, use M-x set-foreground-color, and M-x set-background-color.

To display the list of colors use M-x list-colors-display.

You can execute non-interactive functions (like set-face-attribute) via M-:, in a scratch buffer (C-x C-e), or put them into ~/.emacs.

The same applies to interactive functions (like set-face-foreground, set-face-background, set-foreground-color, set-background-color). But they can also be executed via M-x.

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.