reddit / emacs

how to set custom-face for just a particular theme?

starenka · 2022-11-02 00:03
im trying to set some faces for a particular theme. the problem is, those faces are set globally (=the last use-package def overrides all defined before). any thoughts? cheers ``` (use-package monokai-theme :ensure t :pin melpa :custom-face (mode-line-buffer-id ((nil :foreground "goldenrod1"))) (deadgrep-match-face ((nil :foreground "black" :background "goldenrod1"))) (selectrum-current-candidate ((nil :foreground "black" :background "goldenrod1"))))```
thetemp_ · 2022-11-02 01:45
In the same way that the `:custom` keyword is a replacement for the `custom-set-variables` block, I would assume that the `:custom-face` keyword is a replacement for the `custom-set-faces` block. It's a general way to set faces that alters the 'user theme, which is a theme that overrides all other themes. In other words, it's meant for general use on faces defined by a package and not for altering a specific theme (even if that theme is provided in a package). To set faces specifically for the Monokai theme, you'd want to do something like (custom-theme-set-faces 'monokai (mode-line-buffer-id ((nil :foreground "goldenrod1"))) (deadgrep-match-face ((nil :foreground "black" :background "goldenrod1"))) (selectrum-current-candidate ((nil :foreground "black" :background "goldenrod1")))) This highlights one of the reasons I stopped using Use-Package. It's more work to look up exactly what each part of it does than it is to just use Emacs-Lisp.
starenka · 2022-11-02 08:15
thanks u/thetemp_! this worked (after cleaning hc'd values in `custom.el` which i have no idea they materialized there) ``` (use-package nano-theme :ensure t :config (custom-theme-set-faces 'nano '(mode-line-buffer-id ((nil :foreground "black"))) '(deadgrep-match-face ((nil :foreground "black" :background "#b4eeb4"))) '(selectrum-current-candidate ((nil foreground "black" :background "#b4eeb4"))))) (use-package monokai-theme :ensure t :pin melpa :config (custom-theme-set-faces 'monokai '(mode-line-buffer-id ((nil :foreground "goldenrod1"))) '(deadgrep-match-face ((nil :foreground "black" :background "goldenrod1"))) '(selectrum-current-candidate ((nil :foreground "black" :background "goldenrod1"))))) ```
Craksy · 2022-11-02 15:24
I usually draw inspiration from YouTube thumbnails. Just pick a good one, and practice in front of the mirror until you got it, and hold it while using your theme of choice. It can be helpful to have a small mirror on your desk to check that you're still making the right face. Personally I like to use Gruvbox along with the "surprised, but I also think I might have shit myself"-face