How to reset color theme?

When I’m trying different color themes out, it seems if a particular element is not defined in the new theme the old theme value is retained, and this leads to some clashing. This happens in emacs 24 and also previous versions using color-theme. Is there a way to reset all colors in between to default so that each color theme looks as intended?

shareimprove this question

Are you sure that you are using color themes and not Emacs custom themes? Color themes are defined by library color-theme.el. Custom themes are available starting with Emacs 24 – and they are not the same as color themes.

  1. If you are using color themes then the answer is simple: just enable the pseudo color-theme named [Reset]. That completely undoes the theme: removes all effects that it imposed.
  2. If you are in fact using Emacs custom themes then the answer is not so simple. You cannotundo the application of a custom theme. What you can do, which will help a lot, is to disable each custom theme, using disable-theme, after it has been enabled and before enabling anothercustom theme.Here are two ways to do this “semi-automatically”:

    See those original S.O. posts for a little more info, and see the question and other answers to it on the same S.O. page. (Caveat: The accepted answer on that page is not an answer to the problem of undoing a custom theme.)

  3. Be aware that even the solutions described in #2 are not general solutions: they do not undo the application of a custom theme – there is no way to do that. That is, disabling a custom theme does not restore any non-theme customizations (e.g., face changes) that you might have made before enabling that theme and that were overridden by that theme.

In other words, undoing a color theme is trivial; undoing a custom theme is impossible. The best you can do for a custom theme is to disable it relative to other custom themes.

The best reference for this question and for ways of switching (e.g. cycling) among both color and custom themes is the Emacs Wiki page Color and Custom Themes.

And be forewarned: There is a fair amount of misleading information in various places about Emacs custom themes in this regard. People were rightfully excited that Emacs added custom themes as a feature in Emacs 24, and some of them jumped immediately to the mistaken conclusion that custom themes were a replacement for color themes. They are not. Each has some advantages. Not being able to undo is a major disadvantage of custom themes, for example.

[This GNU Emacs bug report is an enhancement request to remedy the inability to undo a custom theme (and thus restore earlier customizations).]

shareimprove this answer

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s