Added support for background css property

This commit is contained in:
M66B 2021-09-28 07:45:43 +02:00
parent de8162a88e
commit 49570e7e02
1 changed files with 12 additions and 5 deletions

View File

@ -603,12 +603,18 @@ public class HtmlHelper {
String value = kv.get(key); String value = kv.get(key);
switch (key) { switch (key) {
case "color": case "color":
case "background":
case "background-color": case "background-color":
// https://developer.mozilla.org/en-US/docs/Web/CSS/color // https://developer.mozilla.org/en-US/docs/Web/CSS/color
if ("color".equals(key) && !text_color) // https://developer.mozilla.org/en-US/docs/Web/CSS/background
continue; // https://developer.mozilla.org/en-US/docs/Web/CSS/background-color
if ("background-color".equals(key) && !background_color) if ("color".equals(key)) {
continue; if (!text_color)
continue;
} else {
if (!background_color)
continue;
}
Integer color = parseColor(value); Integer color = parseColor(value);
@ -1239,7 +1245,7 @@ public class HtmlHelper {
return document; return document;
} }
static void removeRelativeLinks(Document document){ static void removeRelativeLinks(Document document) {
for (Element a : document.select("a")) for (Element a : document.select("a"))
if (a.attr("href").trim().startsWith("#")) { if (a.attr("href").trim().startsWith("#")) {
a.tagName("span"); a.tagName("span");
@ -2656,6 +2662,7 @@ public class HtmlHelper {
String value = param.substring(semi + 1); String value = param.substring(semi + 1);
switch (key) { switch (key) {
case "color": case "color":
case "background":
case "background-color": case "background-color":
if (!TextUtils.isEmpty(value)) if (!TextUtils.isEmpty(value))
try { try {