Is there any extension or easy way to invert colors in emacs?

I tend to show code a lot through screen sharing and often a light theme is better while the dark is more comfortable for me to work alone.


3 Answers 3


You could use two different color themes and switch between them.

(global-set-key [f5] (lambda () (interactive) (load-theme 'sanityinc-tomorrow-day t)))
(global-set-key [f6] (lambda () (interactive) (load-theme 'sanityinc-tomorrow-night t)))
  • 1
    You cannot switch to themes directly using their names. An elisp call to load a theme is of the type (load-theme 'THEME-NAME t). That has to be wrapped in (lambda () (interactive) .. ) if binding directly to a key. Jun 16, 2015 at 10:24
  • @kaushalmodi In case of color-theme-sanityinc-tomorrow-... this works. But I've changed my answer as you suggested.
    – max0r
    Jun 16, 2015 at 10:36
  • Ah. That theme then might have those wrapper functions built in. Generally theme packages do not have such wrapper functions. Jun 16, 2015 at 10:39
  • You could also just use M-x enable-theme Jun 16, 2015 at 14:04

There's a -rv switch you can use to boot up Emacs in reverse video mode, however I've found it not to work in combination with custom themes.


Your question asks about "inverting colors", which I interpret as "complementing colors". But then you also talk about themes.

  • You can use library Palette (palette.el) to obtain the complement of any color in a WYSIWYG way (so you can easily tweak the result if you like).

  • You can use library hexrgb.el to obtain the complement of any color programmatically (command hexrgb-complement).

  • You can use library Do Re Mi or library Icicles to incrementally adjust colors or face foregrounds/backgrounds.

  • You can use these things (above) to define a new theme starting from an existing theme.

  • You can use library Icicles to cycle among existing themes (color themes or custom themes).

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.