Small optimizations

pull/199/head
M66B 4 years ago
parent 53868387ec
commit 1d5028653b

@ -592,20 +592,19 @@ public class HtmlHelper {
Integer color = parseColor(value); Integer color = parseColor(value);
// fromHtml does not support transparency
//if (color != null)
// color = (0xFFFFFF & color);
if ("color".equals(key)) { if ("color".equals(key)) {
boolean bg = false; boolean bg = false;
Element e = element; if (background_color) {
while (e != null && !bg) Element e = element;
if (e.hasAttr("x-background")) while (e != null && !bg)
bg = true; if (e.hasAttr("x-background"))
else bg = true;
e = e.parent(); else
e = e.parent();
}
// Keep color as-is when background set // Background color set:
// keep text color as-is
if (!bg) { if (!bg) {
// Special case: // Special case:
// external draft / dark background / dark font // external draft / dark background / dark font
@ -629,15 +628,19 @@ public class HtmlHelper {
element.attr("x-background", "true"); element.attr("x-background", "true");
if (dark) { if (dark) {
boolean fg = (parseColor(kv.get("color")) != null); boolean fg = false;
Element e = element; if (text_color) {
while (e != null && !fg) fg = (parseColor(kv.get("color")) != null);
if (e.hasAttr("x-color")) Element e = element;
fg = true; while (e != null && !fg)
else if (e.hasAttr("x-color"))
e = e.parent(); fg = true;
else
e = e.parent();
}
// Force foreground color // Dark theme, background color with no text color:
// force text color
if (!fg) if (!fg)
sb.append("color") sb.append("color")
.append(':') .append(':')

Loading…
Cancel
Save