1

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?

interstar
  • 141
  • 1
  • 1
    Does this answer your question? [Emacs Blue color too dark](https://emacs.stackexchange.com/questions/35959/emacs-blue-color-too-dark) – NickD Sep 01 '20 at 17:07
  • ... and look for the accepted answer, not the highest-voted one (although you should read that one too :-)) – NickD Sep 01 '20 at 17:11
  • Would it work for changing the background colour? – interstar Sep 01 '20 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 Sep 01 '20 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 Sep 01 '20 at 19:09
  • Try `M-x invert-face RET default RET` possibly in combination with customizing `frame-background-mode` to `light`. To go back , do the `invert-face` again and change the customization of `frame-background-mode` to `dark` (or set it to nil). – NickD Sep 01 '20 at 19:15

1 Answers1

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.

x-yuri
  • 281
  • 1
  • 8