[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Trying to define face dynamically
From: |
Óscar Fuentes |
Subject: |
Trying to define face dynamically |
Date: |
Thu, 17 Oct 2019 20:54:34 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) |
(Apologies if this message arrives duplicated. Seems that gmane is
eatin/delaying messages again)
On this mode, which uses Emacs 27 specific features:
https://raw.githubusercontent.com/dcolascione/emacs-window-highlight/master/window-highlight.el
I stumbled on
(mapcar (lambda (face)
(face-remap-add-relative
face '(:filtered (:window has-keyboard-focus t)
window-highlight-focused-window)))
'(default fringe))
This remaps faces "default" and "fringe" to the face
window-highlight-focused-window (defined elsewhere by the user).
I'm trying to get rid of the hard-coded window-highlight-focused-window
face, take the current face and calculate the new attributes on the fly,
so when the theme changes everything is automatically adapted.
Teorically this would darken the background of the windows that have no
keyboard focus by 10%:
(mapcar (lambda (face)
(face-remap-add-relative
face `(:filtered (:window has-keyboard-focus nil)
:background ,(color-darken-name
(face-attribute face :background)
10.0))))
'(default fringe))
But this has not the desired effect: faces remain the same and every now
and then Emacs throws an error "wrong-type-argument stringp nil" from
functions such as font-info.
What I'm doing wrong?
- Trying to define face dynamically,
Óscar Fuentes <=