branch: externals/modus-themes
commit ea135519d3798262048db8c1a8c72fa3a81ae7d8
Author: Protesilaos Stavrou <[email protected]>
Commit: Protesilaos Stavrou <[email protected]>

    Revert to using a readable foreground for the org-habit faces
    
    This relies on our own functions, which should be available even if
    the theme is loaded via the early-init.el.
    
    Thanks to Jacod "Jake" Gordon for reminding me to fix this and for
    testing my prototype. It was done in issue 197:
    <https://github.com/protesilaos/modus-themes/issues/197>.
---
 modus-themes.el | 21 ++++++++-------------
 1 file changed, 8 insertions(+), 13 deletions(-)

diff --git a/modus-themes.el b/modus-themes.el
index c5eed3bb43..93bec4f56a 100644
--- a/modus-themes.el
+++ b/modus-themes.el
@@ -6493,19 +6493,14 @@ If COLOR is unspecified, then return :box unspecified."
     `(org-verse ((,c :inherit modus-themes-fixed-pitch :background 
,bg-prose-block-contents :extend t)))
     `(org-warning ((,c :foreground ,warning)))
 ;;;;; org-habit
-    ;; NOTE 2025-11-12: We used to have `readable-foreground-color'
-    ;; for the foreground values of these faces, but that function
-    ;; breaks the theme if it is loaded in the early-init.el.  Maybe
-    ;; we can find a better solution.  I do not want to introduce new
-    ;; palette entries or a new function just for these faces though.
-    `(org-habit-alert-face ((,c :background ,bg-graph-yellow-0)))
-    `(org-habit-alert-future-face ((,c :background ,bg-graph-yellow-1)))
-    `(org-habit-clear-face ((,c :background ,bg-graph-blue-0)))
-    `(org-habit-clear-future-face ((,c :background ,bg-graph-blue-1)))
-    `(org-habit-overdue-face ((,c :background ,bg-graph-red-0)))
-    `(org-habit-overdue-future-face ((,c :background ,bg-graph-red-1)))
-    `(org-habit-ready-face ((,c :background ,bg-graph-green-0)))
-    `(org-habit-ready-future-face ((,c :background ,bg-graph-green-1)))
+    `(org-habit-alert-face ((,c :background ,bg-graph-yellow-0 :foreground 
,(modus-themes-get-readable-foreground bg-graph-yellow-0))))
+    `(org-habit-alert-future-face ((,c :background ,bg-graph-yellow-1 
:foreground ,(modus-themes-get-readable-foreground bg-graph-yellow-1))))
+    `(org-habit-clear-face ((,c :background ,bg-graph-blue-0 :foreground 
,(modus-themes-get-readable-foreground bg-graph-blue-0))))
+    `(org-habit-clear-future-face ((,c :background ,bg-graph-blue-1 
:foreground ,(modus-themes-get-readable-foreground bg-graph-blue-1))))
+    `(org-habit-overdue-face ((,c :background ,bg-graph-red-0 :foreground 
,(modus-themes-get-readable-foreground bg-graph-red-0))))
+    `(org-habit-overdue-future-face ((,c :background ,bg-graph-red-1 
:foreground ,(modus-themes-get-readable-foreground bg-graph-red-1))))
+    `(org-habit-ready-face ((,c :background ,bg-graph-green-0 :foreground 
,(modus-themes-get-readable-foreground bg-graph-green-0))))
+    `(org-habit-ready-future-face ((,c :background ,bg-graph-green-1 
:foreground ,(modus-themes-get-readable-foreground bg-graph-green-1))))
 ;;;;; org-journal
     `(org-journal-calendar-entry-face ((,c :inherit modus-themes-slant 
:foreground ,date-common)))
     `(org-journal-calendar-scheduled-face ((,c :inherit modus-themes-slant 
:foreground ,date-scheduled-subtle)))

Reply via email to