mirror of
https://github.com/M66B/FairEmail.git
synced 2025-02-24 15:11:03 +00:00
Fixed adjusting compose colors
This commit is contained in:
parent
23e88797ab
commit
768009e45c
1 changed files with 17 additions and 14 deletions
|
@ -561,10 +561,13 @@ public class HtmlHelper {
|
||||||
if (!text_color)
|
if (!text_color)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
Integer color = parseColor(value, dark, textColorPrimary);
|
Integer color = parseColor(value);
|
||||||
if (color == null)
|
if (color == null)
|
||||||
element.removeAttr("color");
|
element.removeAttr("color");
|
||||||
else {
|
else {
|
||||||
|
if (view)
|
||||||
|
color = adjustColor(dark, textColorPrimary, color);
|
||||||
|
|
||||||
// fromHtml does not support transparency
|
// fromHtml does not support transparency
|
||||||
String c = String.format("#%06x", color);
|
String c = String.format("#%06x", color);
|
||||||
sb.append("color:").append(c).append(";");
|
sb.append("color:").append(c).append(";");
|
||||||
|
@ -1211,7 +1214,7 @@ public class HtmlHelper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Integer parseColor(@NonNull String value, boolean dark, int textColorPrimary) {
|
private static Integer parseColor(@NonNull String value) {
|
||||||
// https://developer.mozilla.org/en-US/docs/Web/CSS/color_value
|
// https://developer.mozilla.org/en-US/docs/Web/CSS/color_value
|
||||||
String c = value
|
String c = value
|
||||||
.replace("null", "")
|
.replace("null", "")
|
||||||
|
@ -1280,7 +1283,10 @@ public class HtmlHelper {
|
||||||
Log.i("Color=" + c + ": " + ex);
|
Log.i("Color=" + c + ": " + ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (color != null) {
|
return color;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Integer adjustColor(boolean dark, int textColorPrimary, Integer color) {
|
||||||
int r = Color.red(color);
|
int r = Color.red(color);
|
||||||
int g = Color.green(color);
|
int g = Color.green(color);
|
||||||
int b = Color.blue(color);
|
int b = Color.blue(color);
|
||||||
|
@ -1289,10 +1295,7 @@ public class HtmlHelper {
|
||||||
else
|
else
|
||||||
color = Helper.adjustLuminance(color, dark, MIN_LUMINANCE);
|
color = Helper.adjustLuminance(color, dark, MIN_LUMINANCE);
|
||||||
|
|
||||||
color &= 0xFFFFFF;
|
return (color & 0xFFFFFF);
|
||||||
}
|
|
||||||
|
|
||||||
return color;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean hasVisibleContent(List<Node> nodes) {
|
private static boolean hasVisibleContent(List<Node> nodes) {
|
||||||
|
|
Loading…
Reference in a new issue