|
|
9d4de7 |
From ac15857f14eecd83a3a1950588a2f1edb9cb70de Mon Sep 17 00:00:00 2001
|
|
|
9d4de7 |
From: Milan Crha <mcrha@redhat.com>
|
|
|
9d4de7 |
Date: Fri, 18 Mar 2022 09:45:20 +0100
|
|
|
9d4de7 |
Subject: [PATCH] I#1835 - Mail: Preview uses wrong colors for HTML mail with
|
|
|
9d4de7 |
dark theme
|
|
|
9d4de7 |
|
|
|
9d4de7 |
Closes https://gitlab.gnome.org/GNOME/evolution/-/issues/1835
|
|
|
9d4de7 |
---
|
|
|
9d4de7 |
data/webkit/e-web-view.js | 12 ++++++++++--
|
|
|
9d4de7 |
src/em-format/e-mail-formatter-text-html.c | 2 +-
|
|
|
9d4de7 |
2 files changed, 11 insertions(+), 3 deletions(-)
|
|
|
9d4de7 |
|
|
|
9d4de7 |
diff --git a/data/webkit/e-web-view.js b/data/webkit/e-web-view.js
|
|
|
9d4de7 |
index 7f47fe4b26..a8f99c4668 100644
|
|
|
9d4de7 |
--- a/data/webkit/e-web-view.js
|
|
|
9d4de7 |
+++ b/data/webkit/e-web-view.js
|
|
|
9d4de7 |
@@ -695,8 +695,16 @@ Evo.initialize = function(elem)
|
|
|
9d4de7 |
|
|
|
9d4de7 |
if (doc.documentElement.style.getPropertyValue("color") == "" ||
|
|
|
9d4de7 |
doc.documentElement.style.getPropertyValue("color") == "text") {
|
|
|
9d4de7 |
- doc.documentElement.style.setProperty("color", "inherit");
|
|
|
9d4de7 |
- doc.documentElement.style.setProperty("background-color", "inherit");
|
|
|
9d4de7 |
+ if (doc.defaultView && doc.defaultView.frameElement && !doc.defaultView.frameElement.hasAttribute("x-e-unset-colors") &&
|
|
|
9d4de7 |
+ doc.defaultView.frameElement.ownerDocument &&
|
|
|
9d4de7 |
+ doc.defaultView.frameElement.ownerDocument.defaultView &&
|
|
|
9d4de7 |
+ doc.defaultView.frameElement.ownerDocument.defaultView.window) {
|
|
|
9d4de7 |
+ var style = doc.defaultView.frameElement.ownerDocument.defaultView.window.getComputedStyle(doc.defaultView.frameElement);
|
|
|
9d4de7 |
+ if (style) {
|
|
|
9d4de7 |
+ doc.documentElement.style.setProperty("color", style.color);
|
|
|
9d4de7 |
+ doc.documentElement.style.setProperty("background-color", style.backgroundColor);
|
|
|
9d4de7 |
+ }
|
|
|
9d4de7 |
+ }
|
|
|
9d4de7 |
}
|
|
|
9d4de7 |
|
|
|
9d4de7 |
elems = doc.querySelectorAll("input, textarea, select, button, label");
|
|
|
9d4de7 |
diff --git a/src/em-format/e-mail-formatter-text-html.c b/src/em-format/e-mail-formatter-text-html.c
|
|
|
9d4de7 |
index 708c29a5e4..8a938212ff 100644
|
|
|
9d4de7 |
--- a/src/em-format/e-mail-formatter-text-html.c
|
|
|
9d4de7 |
+++ b/src/em-format/e-mail-formatter-text-html.c
|
|
|
9d4de7 |
@@ -369,7 +369,7 @@ emfe_text_html_format (EMailFormatterExtension *extension,
|
|
|
9d4de7 |
e_mail_part_get_id (part),
|
|
|
9d4de7 |
e_mail_part_get_id (part),
|
|
|
9d4de7 |
e_mail_part_get_frame_security_style (part),
|
|
|
9d4de7 |
- g_settings_get_boolean (settings, "preview-unset-html-colors") ? "x-e-unset-colors=\"1\"" : "style=\"background-color: #ffffff;\"");
|
|
|
9d4de7 |
+ g_settings_get_boolean (settings, "preview-unset-html-colors") ? "x-e-unset-colors=\"1\"" : "style=\"background-color:white; color:black;\"");
|
|
|
9d4de7 |
|
|
|
9d4de7 |
g_output_stream_write_all (
|
|
|
9d4de7 |
stream, str, strlen (str),
|
|
|
9d4de7 |
--
|
|
|
9d4de7 |
GitLab
|
|
|
9d4de7 |
|