Some custom themes use code to generate the face definitions programmatically, which uses other variables like this.

I'd like to export all plain face settings as if they are shown in the buffer created by customize-face to an Elisp file like

     '(citar-highlight ((t :bold nil)))
     '(code-cells-header-line ((t :inherit font-lock-comment-face)))
     '(comint-highlight-prompt ((t nil)))
     '(diff-refine-added ((t (:background "#bbffbb" :inherit diff-refine-changed))))
     '(diff-refine-removed ((t (:inherit diff-refine-changed :background "#ffcccc" :strike-through nil))))
     '(telega-msg-heading ((t (:background "gray94" :family "FZYouHeiS"))))
     ;; ...

with all variables evaluated and replaced by plain color strings, font names, etc. How can I do that?


2 Answers 2


You can retrieve the list of all faces using the function (face-list).

The face information for each face is stored in the face property of the symbol of the face. This is a plist of properties and values, e.g. (:background "LightGrey" :slant italic). Technically, a plist (or property list) is a list where the even elements are keys (:background) and the odd elements values ("LightGrey").

One of the properties is special, :inherit. It takes a face or a list of faces from which it inherits properties from. If you is satisfied with printing :inherit, all you need to do is to print each element of the face property. On the other hand, if you want the values as the face is presented in the current frame, you can use functions like face-foreground to retrieve this information.

To complicate things even further, if you would like determine how the face would look in another kind of frame (e.g. a terminal frame) you will need to check all theme definitions... (This is a major undertaking, so I would recommend it.)

Anyway, there are plenty of ways to attack this, depending on what you want.

One package does a lot of these things is face-explorer, maybe you can find some tools in it which would help you, or at least see how to handle face attributes.

  1. M-: (customize-create-theme 'user)
  2. In the resulting buffer you have the following options
    • Theme name
    • [X] Remove saved theme settings from Custom save file.
  3. Then you can click the Save Theme

Play with the options, and one of that will do what you want.

See also How to customize an existing theme, and create a new theme out of it.

You can replace M-: (customize-create-theme 'user) by M-: (customize-create-theme 'mindre), and give a new theme name of say my-mindre if you want.

(What you want is not very clear to me. One of the above suggestions will work, whatever by your need)

  • Saving that file created by (customize-create-theme 'mindre) is what I want. Thank you! Jul 18, 2022 at 0:51

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.