Simplify making a unfocused face

This commit is contained in:
Lars Tveito 2020-03-08 20:37:31 +01:00
parent 6f7fbd3513
commit 872f24cb26

View File

@ -142,13 +142,13 @@ The timer calls `focus-read-only-hide-cursor' after
(defun focus-make-unfocused-face (fg) (defun focus-make-unfocused-face (fg)
"Add dimmed foreground color FG to the `focus-unfocused` face." "Add dimmed foreground color FG to the `focus-unfocused` face."
(let ((bg (face-background 'default))) (let ((bg (face-background 'default)))
(when (and fg bg (color-defined-p fg) (color-defined-p bg)) (if (and fg bg (color-defined-p fg) (color-defined-p bg)
(if (color-defined-p (face-attribute 'focus-unfocused :foreground)) (not (color-defined-p (face-attribute 'focus-unfocused :foreground))))
'focus-unfocused
(plist-put (face-attr-construct 'focus-unfocused) (plist-put (face-attr-construct 'focus-unfocused)
:foreground (focus-lerp (color-name-to-rgb fg) :foreground (focus-lerp (color-name-to-rgb fg)
(color-name-to-rgb bg) (color-name-to-rgb bg)
focus-fraction)))))) focus-fraction))
'focus-unfocused)))
(defun focus-foreground-from-face (face) (defun focus-foreground-from-face (face)
"Return foreground color for FACE, or 'default if nil." "Return foreground color for FACE, or 'default if nil."