I#1835 - Mail: Preview uses wrong colors for HTML mail with dark theme

Closes https://gitlab.gnome.org/GNOME/evolution/-/issues/1835
This commit is contained in:
Milan Crha
2022-03-18 09:45:20 +01:00
parent a6b4f08cb6
commit ac15857f14
2 changed files with 11 additions and 3 deletions

View File

@ -695,8 +695,16 @@ Evo.initialize = function(elem)
if (doc.documentElement.style.getPropertyValue("color") == "" ||
doc.documentElement.style.getPropertyValue("color") == "text") {
doc.documentElement.style.setProperty("color", "inherit");
doc.documentElement.style.setProperty("background-color", "inherit");
if (doc.defaultView && doc.defaultView.frameElement && !doc.defaultView.frameElement.hasAttribute("x-e-unset-colors") &&
doc.defaultView.frameElement.ownerDocument &&
doc.defaultView.frameElement.ownerDocument.defaultView &&
doc.defaultView.frameElement.ownerDocument.defaultView.window) {
var style = doc.defaultView.frameElement.ownerDocument.defaultView.window.getComputedStyle(doc.defaultView.frameElement);
if (style) {
doc.documentElement.style.setProperty("color", style.color);
doc.documentElement.style.setProperty("background-color", style.backgroundColor);
}
}
}
elems = doc.querySelectorAll("input, textarea, select, button, label");

View File

@ -369,7 +369,7 @@ emfe_text_html_format (EMailFormatterExtension *extension,
e_mail_part_get_id (part),
e_mail_part_get_id (part),
e_mail_part_get_frame_security_style (part),
g_settings_get_boolean (settings, "preview-unset-html-colors") ? "x-e-unset-colors=\"1\"" : "style=\"background-color: #ffffff;\"");
g_settings_get_boolean (settings, "preview-unset-html-colors") ? "x-e-unset-colors=\"1\"" : "style=\"background-color:white; color:black;\"");
g_output_stream_write_all (
stream, str, strlen (str),