From 2c225b634e61c00cc21889cffbc45fa1b8de377f Mon Sep 17 00:00:00 2001 From: Protesilaos Stavrou Date: Sat, 31 Jan 2026 09:59:34 +0200 Subject: [PATCH] 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 7e14a8c..2dfbc73 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'."