Hi Prot :)
The common palette overrides and changing how color "pointers" work is
great. I got to a point where I tweaked the mode-line to be borderless
and notices that inheriting the colors doesn't work as I expected after
reading the docs.
Here's a mimimal example:
First, re-wire the 'bg-mode-line-active' color reference for all themes:
(customize-set-variable 'modus-themes-common-palette-overrides
`((bg-mode-line-active bg-inactive)))
When you go ahead and override a specific palette, though, to e.g.
change the inactive color which was just referenced:
(customize-set-variable 'modus-operandi-deuteranopia-palette-overrides
`((bg-inactive "#efefef")))
... the result surprised me. When I inspect the colors, e.g. via:
(modus-themes-with-colors `(,bg-inactive ,bg-mode-line-active))
... it returns ("#efefef" "#d0d6ff") in this setting, even though I
"pointed" 'bg-mode-line-active' color to the 'bg-inactive' color.
My use case is to read the 'bg-mode-line-active' color and change the
mode-line face's :box property to add 10px of the background color
around it for some visual padding. Instead, the mode-line background was
resolved to be light gray while the border was blue-ish.
A fix is simple enough, inheriting the common overrides like so:
(customize-set-variable 'modus-operandi-deuteranopia-palette-overrides
`((bg-inactive "#efefef")
,@modus-themes-common-palette-overrides))
But from the docs it sounded like this kind of "merging" would happen
automatically. So I'm not sure which is supposed to be the way things
should work.
- Mention in the docs that inheritance/merging doesn't work the way I
outlined my expectations?
- Change the behavior to inherit the common palette overrides automatically?
Cheers,
Christian
--
Sent from Bielefeld, Germany <3
https://christiantietze.de -- Programming + Personal
https://zettelkasten.de -- Creative Knowledge Work
> From: Christian Tietze <me@christiantietze.de>
> Date: Fri, 30 Dec 2022 14:10:29 +0100
>
> Hi Prot :)
Hello Christian,
> The common palette overrides and changing how color "pointers" work is
> great. I got to a point where I tweaked the mode-line to be borderless
> and notices that inheriting the colors doesn't work as I expected after
> reading the docs.
> [... 39 lines elided]
> - Change the behavior to inherit the common palette overrides automatically?
It was a bug in a private function that manifested in the macro
modus-themes-with-colors. Here is what I did and now common palette
overrides are inherited everywhere.
modus-themes.el | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/modus-themes.el b/modus-themes.el
index a85ee1c..b71b474 100644
--- a/modus-themes.el
+++ b/modus-themes.el
@@ -1076,7 +1076,9 @@ (defun modus-themes--palette-value (theme &optional overrides)
"Return palette value of THEME with optional OVERRIDES."
(let ((base-value (symbol-value (modus-themes--palette-symbol theme))))
(if overrides
- (append (symbol-value (modus-themes--palette-symbol theme :overrides)) base-value)
+ (append (symbol-value (modus-themes--palette-symbol theme :overrides))
+ modus-themes-common-palette-overrides
+ base-value)
base-value)))
(defun modus-themes--current-theme-palette (&optional overrides)
All the best,
Prot
--
Protesilaos Stavrou
https://protesilaos.com