unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Trying to define face dynamically
@ 2019-10-17 18:54 Óscar Fuentes
  2019-10-17 19:30 ` Eli Zaretskii
  0 siblings, 1 reply; 4+ messages in thread
From: Óscar Fuentes @ 2019-10-17 18:54 UTC (permalink / raw)
  To: help-gnu-emacs

(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?



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-10-18  0:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-10-17 18:54 Trying to define face dynamically Óscar Fuentes
2019-10-17 19:30 ` Eli Zaretskii
2019-10-17 19:54   ` Óscar Fuentes
2019-10-18  0:15     ` Óscar Fuentes

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).