Automatically adapt micro-state faces to the current theme

This commit is contained in:
syl20bnr 2015-02-12 00:14:38 -05:00
parent a909d48386
commit fa4c659832
2 changed files with 25 additions and 14 deletions

View File

@ -11,20 +11,29 @@
;;
;;; License: GPLv3
(defface spacemacs-micro-state-header-face
`((t (:background
"DarkGoldenrod2"
:foreground "black"
:bold t :box ,(face-attribute 'mode-line :box))))
"Face for micro-state header in echo area.
The header is composed of the text before the first `:'"
:group 'spacemacs)
(defface spacemacs-micro-state-binding-face
`((t (:foreground ,(face-attribute 'error :foreground) :bold t)))
"Face for micro-state key binding in echo area.
(defun spacemacs//defface-micro-state-faces ()
"Define faces for micro-states."
(let* ((hname 'spacemacs-micro-state-header-face)
(bname 'spacemacs-micro-state-binding-face)
(box (face-attribute 'mode-line :box))
(err (face-attribute 'error :foreground)))
(eval `(defface ,hname '((t ()))
"Face for micro-state header in echo area.
The header is the name of the micro-state."
:group 'spacemacs))
(set-face-attribute hname nil
:background "DarkGoldenrod2"
:foreground "black"
:bold t
:box box)
(eval `(defface ,bname '((t ()))
"Face for micro-state key binding in echo area.
Characters enclosed in `[]' will have this face applied to them."
:group 'spacemacs)
:group 'spacemacs))
(set-face-attribute bname nil
:foreground err
:bold t)))
(spacemacs//defface-micro-state-faces)
(defmacro spacemacs|define-micro-state (name &rest props)
"Define a micro-state called NAME.
@ -98,7 +107,7 @@ Available PROPS:
(defdoc ,@default-doc))
(if bdoc
(echo (spacemacs//micro-state-propertize-doc
(concat ,(symbol-name name) ":" bdoc)))
(concat ,(symbol-name name) ": " bdoc)))
(when defdoc
(echo (spacemacs//micro-state-propertize-doc
(concat ,(symbol-name name) ":"

View File

@ -120,6 +120,8 @@ changed to THEME."
(spacemacs/set-flycheck-mode-line-faces))
(if (fboundp 'spacemacs/set-new-version-lighter-mode-line-faces)
(spacemacs/set-new-version-lighter-mode-line-faces))
(if (fboundp 'spacemacs//defface-micro-state-faces)
(spacemacs//defface-micro-state-faces))
(if (fboundp 'powerline-reset)
(powerline-reset)))