I'm trying to switch to another Emacs theme, and I noticed I had several hard coded color strings which I used with my previous theme. I'm looking for a way to use :inherit and thus have those hard coded strings in one place.

(make-face 'me/header-face)
(set-face-attribute 'me/header-face nil
                    :background 'unspecified :foreground solarized/blue
                    :italic nil :underline nil :weight 'bold)

(set-face-attribute 'helm-source-header nil :inherit 'me/header-face)

But some additonnal style is being applied to 'helm-source-header.


It appears that the Solarized theme applies his own attributes. How do I tell I only want my own definitions ?

  • The colors are lines 51 to 92 of the source code that you attached. Are you interested in changing the values of any of those? Or, are you interested in adding additional settings such as underlines and so forth?
    – lawlist
    Jan 25 '15 at 18:49
  • Yeah example in the picture is using solarized-theme, but jazz-theme is also adding his own attributes to faces. How would I use me/header-face's attributes only ? Furthermore, am I getting the good approach to do that ? Jan 25 '15 at 18:51
  • 1
    I'm not afraid about doing so, but I don't want to edit vendor files everytime I update them :/. Jan 25 '15 at 18:55
  • 1
    I would redefine it without using :inherit (aka merge): (set-face-attribute 'helm-source-header nil :background 'unspecified :foreground solarized/blue :italic nil :underline nil :weight 'bold) The attribute :inherit means: The name of a face from which to inherit attributes, or a list of face names. Attributes from inherited faces are merged into the face like an underlying face would be, with higher priority than underlying faces. If a list of faces is used, attributes from faces earlier in the list override those from later faces.
    – lawlist
    Jan 25 '15 at 19:27
  • 2
    It looks like you are missing a set of parentheses around the attributes, and green is not a variable so it needs to be in double-quotes. Example: (defface my-active-region-face '((t (:background "gray30" :foreground "white"))) "Face for 'my-active-region-face'." :group 'my-ruler-faces)
    – lawlist
    Jan 26 '15 at 4:09

In the same buffer as the screenshot you provide, toggle off each of the attributes you don't want and save it. In your case, you should toggle off everything but the inherit item.

The customize interface always gives priority to user customizations. So, the theme's definition will be overriden by yours for that specific face. In fact, even if you later change to another theme which applies different attributes to that face, your saved customization will still take precedence.


It's possible to enable more than one theme at a time. If you create a theme (using deftheme) that contains the your face definitions you can enable it at the same time as any package theme you want to use.

For example, in my .emacs.d I have defined a theme called pd-basic that contains the faces I want to override. To use it with zenburn I call the following:

(load-theme 'zenburn t t)
(load-theme 'pd-basic t t)
(custom-set-variables '(custom-enabled-themes '(pd-basic zenburn)))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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