1

I'd like to write a theme from all known faces (face colors and styles - as one would typically find in a theme).

There is a way to write themes customize-create-theme, however it only writes some colors, not all the colors listed from list-faces-display.

How can I do this?

Example snippet (not )

(deftheme my-theme "Description.")

(custom-theme-set-faces 'my-theme
  '(font-lock-keyword-face ((t (:foreground "#808bed"))))
  '(font-lock-preprocessor-face ((t (:foreground "#409090"))))
  '(font-lock-reference-face ((t (:bold t :foreground "#808bed"))))
  '(font-lock-string-face ((t (:foreground "#ffcd8b" :background "#404040"))))
  ;; -- snip --
  )

To give some context, I have my own theme which I'd like to update with some existing colors & face (bold/italic etc).

1
  • Clarified (face style and colors).
    – ideasman42
    Jun 29 '20 at 1:33
1

The function customize-create-theme only includes the faces listed in custom-theme--listed-faces. I guess you can set it to (face-list) to make it include more faces.

However, there is a risk you might become overwhelmed, in my setup custom-theme--listed-faces contains 44 faces whereas 447 faces are defined.

A side note: Some years ago I was pondering what it would take to make it easier to define a theme what would work well for many users using face-heave third party packages. My idea was to define a set of base faces (ranging from the basic faces like font-lock-comment-face to faces like 10 highlighting variants), roughly 50 to 100 faces. The next step would be to encourage people to inherit from this set, rather than defining new faces from scratch. In this case, each theme could work in all environments, for all packages, by only defining the base set. An added bonus would be that we could define test pages containing all sane combinations of faces, which could be used when developing new themes.

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.