branch: externals/modus-themes
commit 3b0bbaa77962ea6f68adb5c7ca929953c55b0992
Author: Protesilaos Stavrou <[email protected]>
Commit: Protesilaos Stavrou <[email protected]>
Simplify modus-themes-color-warm-p
Thanks to Stefan Monnier for pointing this out on the emacs-devel
mailing list:
<https://lists.gnu.org/archive/html/emacs-devel/2025-11/msg00996.html>.
It is what I was trying to do before with 'color-distance', per the
comment right above:
;; NOTE 2025-11-25: I used to rely on `color-distance', thinking that
;; it would do the right thing here:
;;
;; (> (color-distance color "#ff0000") (color-distance color
"#0000ff"))
;;
;; But my understanding of "warm" versus "cold" is simple, so better
;; do it my way.
But I did not originally see the simpler modus-themes-color-warm-p, so here
we are!
---
modus-themes.el | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/modus-themes.el b/modus-themes.el
index 82aaabbc60..091ef2726d 100644
--- a/modus-themes.el
+++ b/modus-themes.el
@@ -7559,10 +7559,10 @@ inclusive."
;; do it my way.
(defun modus-themes-color-warm-p (color)
"Return non-nil if COLOR is warm.
-A warm color has more contribution from the red and green channels of
-light than from the green and blue."
- (pcase-let ((`(,r ,g ,b) (color-name-to-rgb color)))
- (> (+ r g) (+ g b))))
+A warm color has more contribution from the red channel of light than
+the blue one."
+ (pcase-let ((`(,r ,_ ,b) (color-name-to-rgb color)))
+ (> r b)))
(defun modus-themes-color-is-warm-or-cool-p (color fallback-preference)
"Return `warm' or `cool' for COLOR depending on its value.