Fixed pasted white text on transparent background

This commit is contained in:
M66B 2021-11-08 12:12:35 +01:00
parent cb509b3ab1
commit 26b0033929
1 changed files with 7 additions and 6 deletions

View File

@ -644,15 +644,16 @@ public class HtmlHelper {
e = e.parent(); e = e.parent();
} }
if (bg == null) { if (!view && dark &&
color != null && (bg == null || bg == Color.TRANSPARENT)) {
// Special case: // Special case:
// external draft / dark background / very dark/light font // external draft / dark background / very dark/light font
if (color != null && !view && dark) {
double lum = ColorUtils.calculateLuminance(color); double lum = ColorUtils.calculateLuminance(color);
if (lum < MIN_LUMINANCE_DARK || lum > 1 - MIN_LUMINANCE_DARK) if (lum < MIN_LUMINANCE_DARK || lum > 1 - MIN_LUMINANCE_DARK)
color = null; color = null;
} }
if (bg == null) {
if (color != null && view) if (color != null && view)
color = adjustColor(dark, textColorPrimary, color); color = adjustColor(dark, textColorPrimary, color);
} else if (bg == Color.TRANSPARENT) { } else if (bg == Color.TRANSPARENT) {