commit 34cf206290be94f490ee182ca8a43927ddbf657d parent 34bcc92d18ab6373205eed356b41ff3206fa01e3 Author: Alex Balgavy <alex@balgavy.eu> Date: Wed, 28 Sep 2022 20:16:31 +0200 emacs: improve setting of modeline color on god mode Diffstat:
M | emacs/config.org | | | 19 | +++++++++++++------ |
1 file changed, 13 insertions(+), 6 deletions(-)
diff --git a/emacs/config.org b/emacs/config.org @@ -1269,13 +1269,20 @@ Prism changes the color of text depending on their depth. Makes it easier to see ("i" . god-local-mode)) :hook (post-command . za/god-mode-update-mode-line) :config - (setq za/god-mode-active-modeline-bg "#770085") - (setq za/god-mode-inactive-modeline-bg (face-attribute 'mode-line :background)) (defun za/god-mode-update-mode-line () - (cond (god-local-mode (set-face-attribute 'mode-line nil - :background za/god-mode-active-modeline-bg)) - (t (set-face-attribute 'mode-line nil - :background za/god-mode-inactive-modeline-bg))))) + "Update the color of the modeline depending on god-mode." + (cond (god-local-mode + (set-face-attribute 'mode-line nil :background "#770085")) + (t + (let* ((current-theme (car custom-enabled-themes)) + (theme-settings (get current-theme 'theme-settings))) + (dolist (theme-setting theme-settings) + (if (and (eq (car theme-setting) 'theme-face) + (eq (cadr theme-setting) 'mode-line)) + (let* ((face-def (caar (last theme-setting))) + (properties (car (last face-def))) + (bg (plist-get properties :background))) + (set-face-attribute 'mode-line nil :background bg))))))))) #+end_src * Mode/language specific packages ** Org