From 403fbcc8a7d5b20e43aaee729c87a102900f20f5 Mon Sep 17 00:00:00 2001 From: M66B Date: Mon, 21 Oct 2024 19:26:11 +0200 Subject: [PATCH] Fixed black text on white background override --- app/src/main/java/eu/faircode/email/HtmlHelper.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/HtmlHelper.java b/app/src/main/java/eu/faircode/email/HtmlHelper.java index 39c10791ab..89e645f80b 100644 --- a/app/src/main/java/eu/faircode/email/HtmlHelper.java +++ b/app/src/main/java/eu/faircode/email/HtmlHelper.java @@ -801,8 +801,11 @@ public class HtmlHelper { } } - if (color != null) - element.attr("x-color", "true"); + if (color != null) { + double lum = ColorUtils.calculateLuminance(color); + if (dark ? lum > 1 - MIN_LUMINANCE_VIEW : lum < MIN_LUMINANCE_VIEW) + element.attr("x-color", "true"); + } } else /* background */ { if (color != null && !hasColor(color)) color = Color.TRANSPARENT;