mirror of https://github.com/M66B/FairEmail.git
Prevent (copied) light text on dark background (composer)
This commit is contained in:
parent
bb2fd9a3b8
commit
8a4be7cf61
|
@ -140,6 +140,7 @@ public class HtmlHelper {
|
||||||
private static final int GRAY_THRESHOLD = Math.round(255 * 0.2f);
|
private static final int GRAY_THRESHOLD = Math.round(255 * 0.2f);
|
||||||
private static final int COLOR_THRESHOLD = Math.round(255 * 0.1f);
|
private static final int COLOR_THRESHOLD = Math.round(255 * 0.1f);
|
||||||
private static final float MIN_LUMINANCE = 0.7f;
|
private static final float MIN_LUMINANCE = 0.7f;
|
||||||
|
private static final float MIN_LUMINANCE_DARK = 0.1f;
|
||||||
private static final int TAB_SIZE = 2;
|
private static final int TAB_SIZE = 2;
|
||||||
private static final int MAX_ALT = 250;
|
private static final int MAX_ALT = 250;
|
||||||
private static final int MAX_AUTO_LINK = 250;
|
private static final int MAX_AUTO_LINK = 250;
|
||||||
|
@ -645,10 +646,10 @@ public class HtmlHelper {
|
||||||
|
|
||||||
if (bg == null) {
|
if (bg == null) {
|
||||||
// Special case:
|
// Special case:
|
||||||
// external draft / dark background / dark font
|
// external draft / dark background / very dark/light font
|
||||||
if (color != null && !view && dark) {
|
if (color != null && !view && dark) {
|
||||||
double lum = ColorUtils.calculateLuminance(color);
|
double lum = ColorUtils.calculateLuminance(color);
|
||||||
if (lum < 0.1)
|
if (lum < MIN_LUMINANCE_DARK || lum > 1 - MIN_LUMINANCE_DARK)
|
||||||
color = null;
|
color = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue