diff --git a/app/src/main/java/eu/faircode/email/MessageHelper.java b/app/src/main/java/eu/faircode/email/MessageHelper.java index 74a97e3518..46a531e8b6 100644 --- a/app/src/main/java/eu/faircode/email/MessageHelper.java +++ b/app/src/main/java/eu/faircode/email/MessageHelper.java @@ -962,24 +962,16 @@ public class MessageHelper { HtmlHelper.autoLink(document, true); } + StringBuilder style = new StringBuilder(); + if (compose_color != Color.TRANSPARENT) - document.head().append(""); - - if (!TextUtils.isEmpty(compose_font)) { - List childs = new ArrayList<>(); - for (Node child : document.body().childNodes()) - if (TextUtils.isEmpty(child.attr("fairemail"))) { - childs.add(child); - child.remove(); - } else - break; + style.append("* {color: ").append(HtmlHelper.encodeWebColor(compose_color)).append(";}").append('\n'); - Element div = document.createElement("div").attr("style", - "font-family:" + StyleHelper.getFamily(compose_font)); - for (Node child : childs) - div.appendChild(child); - document.body().prependChild(div); - } + if (!TextUtils.isEmpty(compose_font)) + style.append("* {font-family: ").append(StyleHelper.getFamily(compose_font)).append(";}").append('\n'); + + if (style.length() > 0) + document.head().append(""); document.select("div[fairemail=signature]").removeAttr("fairemail"); document.select("div[fairemail=reference]").removeAttr("fairemail");