Re: Automatic face re-application with frame-set-background-mode
Antonio Romano <[email protected]>
| Newsgroups | gmane.emacs.help |
|---|---|
| Message-ID | <[email protected]> |
Il 11 aprile 2026 15:44:30 CEST, Antonio Romano <[email protected]> ha scritto: >Hello, > >I’m experimenting with themes on Emacs (using master branch) and >noticed some behavior related to `frame-set-background-mode` that I’d >like to clarify. > >I created a minimal working example theme as follows: > >``` >;; -*- lexical-binding: t; -*- >(deftheme mve-theme "Minimal MVE") > >(custom-theme-set-faces > 'default > `(default > ((((background light)) :background "white" :foreground "black") > (((background dark)) :background "black" :foreground "white"))) > `(mode-line > ((((background light)) :background "yellow" :foreground "black") > (((background dark)) :background "red" :foreground "white")))) > >(provide-theme 'mve-theme) >``` > >Steps I performed: > >Run `emacs -Q` >Load the theme with `M-x load-theme mve-theme`. >Call `(setopt frame-background-mode 'dark)`. > >Notable observations: > >* The fringe (unspecified in this theme) changes to black. >* The mode-line stays yellow. >* The default face does not change. This is true even with the >`default` theme. >* Syntax highlighting colors in emacs-lisp-mode update according to >background-mode. > >It seems that some faces do get re-applied after a `background-mode` >switch, while others do not. Even when they do, they do not honor my >`custom-theme-set-faces` settings. > >I’m trying to understand: > >What conditions determine which faces are automatically recalculated >when `frame-set-background-mode` is called? >Is this behavior hardcoded for built-in faces only? >Are there plans or best practices for making theme faces reactive to >background-mode changes without manually reapplying the theme? > >Thank you for any clarification or guidance. Bumping the question. At this point I'm pretty sure that `frame-set-backgroud-mode` only recalculates faces for those that are neither user-customized nor themed. I wonder what's the rationale behind that and if it's an intended behaviour. The `background` display entry would be great for defining a light/dark variant in a single theme.
signature.asc
(application/pgp-signature, 244 B)
-----BEGIN PGP SIGNATURE----- iIAEABYIACghHEFudG9uaW8gUm9tYW5vIDxjaWRyYUBwb3N0ZW8uaXQ+BQJqiBKW AAoJECWicgESp/TP638BAKt2mAuXbCNuHyv1/WqJVUOsdw5qTwCOeDnggUTqM/Ss AQCDnfZFqul4C6E3D/aZmRGKqvcVdr00SjJKd+B7K8xtBA== =4evH -----END PGP SIGNATURE-----