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

    Define function to get readable foreground, based on our own "dark-p" (per 
commit 4ecefd9)
---
 modus-themes.el | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/modus-themes.el b/modus-themes.el
index 7e14a8c060..2dfbc735d4 100644
--- a/modus-themes.el
+++ b/modus-themes.el
@@ -4210,6 +4210,13 @@ Run `modus-themes-after-load-theme-hook' after loading a 
theme."
 Test that HEX-COLOR has more contrast against white than black."
   (> (modus-themes-contrast hex-color "#ffffff")
      (modus-themes-contrast hex-color "#000000")))
+
+(defun modus-themes-get-readable-foreground (hex-color)
+  "Get readable foreground for background hexadecimal RGB HEX-COLOR."
+  (if (modus-themes-color-dark-p hex-color)
+      "#ffffff"
+    "#000000"))
+
 (defun modus-themes--list-colors-get-mappings (palette)
   "Get the semantic palette entries in PALETTE.
 PALETTE is the value of a variable like `modus-operandi-palette'."

Reply via email to