Implement faces so that (e.g. Modus) themes can hook into God
rudolf-adamkovic opened this issue · comments
TL;DR Instead of hard-coding status bar colors (as suggested in README
), why not let Emacs do its job?
Context:
Thanks for the idea @salutis!
Doom Emacs uses face-background
to achieve something very similar for the cursor color, as shown here, without hard coded colors.
If you've got a theme that you prefer, you can easily use colors from it using face-background
, as follows:
(defun my-god-mode-update-modeline ()
(let ((limited-colors-p (> 257 (length (defined-colors)))))
(cond (god-local-mode (progn
(set-face-background 'mode-line (face-background 'modus-themes-active-blue))
(set-face-background 'mode-line-inactive (face-background 'modus-themes-active-blue))))
(t (progn
(set-face-background 'mode-line (face-background 'modus-themes-active-red))
(set-face-background 'mode-line-inactive (face-background 'modus-themes-active-red)))))))
(add-hook 'god-mode-enabled-hook #'my-god-mode-update-modeline)
(add-hook 'god-mode-disabled-hook #'my-god-mode-update-modeline)
I've used the modus-themes-active-blue
and modus-themes-active-red
faces in the my-god-mode-update-modeline
function above, but you can use any face you prefer.
You can also directly use colors from the modus-themes-vivendi-colors
or modus-themes-operandi-colors
constants in modus-themes to achieve a similar effect, without using face-background
.
While this can be implemented in God mode using faces, not all users would want to change the mode line color depending on whether God mode is enabled.
In fact, God mode tries really hard to stay away from the territory of themes and faces.
@darth10 Oh, I see! We can use the named colors from the theme. That is fantastic. Thank you so much for taking time to explain this to me. (I am new to Emacs.)