From 2d675ec921f26ab8cd4c1f6264b8cd5f6a83b4d3 Mon Sep 17 00:00:00 2001 From: M66B Date: Sun, 18 Dec 2022 07:44:17 +0100 Subject: [PATCH] Fixed default font color --- .../java/eu/faircode/email/MessageHelper.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/MessageHelper.java b/app/src/main/java/eu/faircode/email/MessageHelper.java index 96f033e21d..092f7f0a10 100644 --- a/app/src/main/java/eu/faircode/email/MessageHelper.java +++ b/app/src/main/java/eu/faircode/email/MessageHelper.java @@ -964,10 +964,7 @@ public class MessageHelper { HtmlHelper.autoLink(document, true); } - if (compose_color != Color.TRANSPARENT) - document.head().append(""); - - if (!TextUtils.isEmpty(compose_font)) { + if (!TextUtils.isEmpty(compose_font) || compose_color != Color.TRANSPARENT) { List childs = new ArrayList<>(); for (Node child : document.body().childNodes()) if (TextUtils.isEmpty(child.attr("fairemail"))) { @@ -976,8 +973,14 @@ public class MessageHelper { } else break; - Element div = document.createElement("div").attr("style", - "font-family:" + StyleHelper.getFamily(compose_font)); + StringBuilder style = new StringBuilder(); + if (!TextUtils.isEmpty(compose_font)) + style.append("font-family: ").append(StyleHelper.getFamily(compose_font)).append(';'); + if (compose_color != Color.TRANSPARENT) + style.append("color: ").append(HtmlHelper.encodeWebColor(compose_color)).append(';'); + + Element div = document.createElement("div").attr("style", style.toString()); + for (Node child : childs) div.appendChild(child); document.body().prependChild(div);