summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2021-07-21 13:47:27 +0200
committerMilan Crha <mcrha@redhat.com>2021-07-21 13:50:17 +0200
commit978e80fcc5c5a42a48174a4eea3d2fbb2e50d276 (patch)
tree705c896dc13e104cc837bd7dd0539f102ed74100
parent4cb5f87f5193068dfc7c997b5d98a957121745e9 (diff)
downloadevolution-978e80fcc5c5a42a48174a4eea3d2fbb2e50d276.tar.gz
I#1522 - WebView: Enable light/dark color scheme for the preview panels
Works only with WebkitGTK with this change included: https://bugs.webkit.org/show_bug.cgi?id=208204 Closes https://gitlab.gnome.org/GNOME/evolution/-/issues/1522
-rw-r--r--data/webkit/webview-print.css4
-rw-r--r--data/webkit/webview.css4
-rw-r--r--src/addressbook/gui/widgets/eab-contact-formatter.c1
-rw-r--r--src/calendar/gui/e-cal-component-preview.c1
-rw-r--r--src/e-util/e-web-view.c8
-rw-r--r--src/em-format/e-mail-formatter-print.c1
-rw-r--r--src/em-format/e-mail-formatter.c2
-rw-r--r--src/mail/e-mail-display.c1
8 files changed, 19 insertions, 3 deletions
diff --git a/data/webkit/webview-print.css b/data/webkit/webview-print.css
index 1962e4c221..2b3289d0d2 100644
--- a/data/webkit/webview-print.css
+++ b/data/webkit/webview-print.css
@@ -1,3 +1,7 @@
+:root {
+ color-scheme: light dark; /* both supported */
+}
+
html, body {
padding: 0;
margin: 0;
diff --git a/data/webkit/webview.css b/data/webkit/webview.css
index 4ad90c97f8..3788d78423 100644
--- a/data/webkit/webview.css
+++ b/data/webkit/webview.css
@@ -1,3 +1,7 @@
+:root {
+ color-scheme: light dark; /* both supported */
+}
+
html, body {
padding: 0;
margin: 0;
diff --git a/src/addressbook/gui/widgets/eab-contact-formatter.c b/src/addressbook/gui/widgets/eab-contact-formatter.c
index c4755e3ea4..63a0d32fd5 100644
--- a/src/addressbook/gui/widgets/eab-contact-formatter.c
+++ b/src/addressbook/gui/widgets/eab-contact-formatter.c
@@ -51,6 +51,7 @@
#define HTML_HEADER "<!doctype html public \"-//W3C//DTD HTML 4.0 TRANSITIONAL//EN\">\n<html>\n" \
"<head>\n<meta name=\"generator\" content=\"Evolution Addressbook Component\">\n" \
+"<meta name=\"color-scheme\" content=\"light dark\">\n" \
"<link type=\"text/css\" rel=\"stylesheet\" href=\"evo-file://$EVOLUTION_WEBKITDATADIR/webview.css\">" \
"<style type=\"text/css\">\n" \
" div#header { width:100%; clear: both; }\n" \
diff --git a/src/calendar/gui/e-cal-component-preview.c b/src/calendar/gui/e-cal-component-preview.c
index 712a5cd00a..0901eca6d7 100644
--- a/src/calendar/gui/e-cal-component-preview.c
+++ b/src/calendar/gui/e-cal-component-preview.c
@@ -61,6 +61,7 @@ struct _ECalComponentPreviewPrivate {
#define HTML_HEADER "<!doctype html public \"-//W3C//DTD HTML 4.0 TRANSITIONAL//EN\">\n<html>\n" \
"<head>\n<meta name=\"generator\" content=\"Evolution Calendar Component\">\n" \
+ "<meta name=\"color-scheme\" content=\"light dark\">\n" \
"<link type=\"text/css\" rel=\"stylesheet\" href=\"evo-file://$EVOLUTION_WEBKITDATADIR/webview.css\">\n" \
"<style>\n" \
".description { font-family: monospace; font-size: 1em; }\n" \
diff --git a/src/e-util/e-web-view.c b/src/e-util/e-web-view.c
index 1146469c19..551ccb5b65 100644
--- a/src/e-util/e-web-view.c
+++ b/src/e-util/e-web-view.c
@@ -1976,8 +1976,8 @@ web_view_submit_alert (EAlertSink *alert_sink,
buffer,
"<html>"
"<head>"
- "<meta http-equiv=\"content-type\""
- " content=\"text/html; charset=utf-8\">"
+ "<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\">"
+ "<meta name=\"color-scheme\" content=\"light dark\">"
"</head>"
"<body>");
@@ -2625,7 +2625,9 @@ e_web_view_clear (EWebView *web_view)
e_web_view_load_string (web_view,
"<html>"
- "<head></head>"
+ "<head>"
+ "<meta name=\"color-scheme\" content=\"light dark\">"
+ "</head>"
"<body class=\"-e-web-view-background-color -e-web-view-text-color\"></body>"
"</html>");
}
diff --git a/src/em-format/e-mail-formatter-print.c b/src/em-format/e-mail-formatter-print.c
index d302b17a5e..873fe9b2e4 100644
--- a/src/em-format/e-mail-formatter-print.c
+++ b/src/em-format/e-mail-formatter-print.c
@@ -117,6 +117,7 @@ mail_formatter_print_run (EMailFormatter *formatter,
"<html>\n"
"<head>\n"
"<meta name=\"generator\" content=\"Evolution Mail\" />\n"
+ "<meta name=\"color-scheme\" content=\"light dark\">\n"
"<title>Evolution Mail Display</title>\n"
"<link type=\"text/css\" rel=\"stylesheet\" media=\"print\" href=\"" STYLESHEET_URI "\"/>\n"
"</head>\n"
diff --git a/src/em-format/e-mail-formatter.c b/src/em-format/e-mail-formatter.c
index fb88f875ff..1933a690f1 100644
--- a/src/em-format/e-mail-formatter.c
+++ b/src/em-format/e-mail-formatter.c
@@ -1140,6 +1140,7 @@ e_mail_formatter_get_sub_html_header (EMailFormatter *formatter)
"<html>\n"
"<head>\n"
"<meta name=\"generator\" content=\"Evolution Mail\"/>\n"
+ "<meta name=\"color-scheme\" content=\"light dark\">\n"
"<title>Evolution Mail Display</title>\n"
"<link type=\"text/css\" rel=\"stylesheet\" "
" href=\"" STYLESHEET_URI "\"/>\n"
@@ -1158,6 +1159,7 @@ e_mail_formatter_get_html_header (EMailFormatter *formatter)
"<html>\n"
"<head>\n"
"<meta name=\"generator\" content=\"Evolution Mail\"/>\n"
+ "<meta name=\"color-scheme\" content=\"light dark\">\n"
"<title>Evolution Mail Display</title>\n"
"<link type=\"text/css\" rel=\"stylesheet\" "
" href=\"" STYLESHEET_URI "\"/>\n"
diff --git a/src/mail/e-mail-display.c b/src/mail/e-mail-display.c
index c7cdd8424c..ba0ec8892a 100644
--- a/src/mail/e-mail-display.c
+++ b/src/mail/e-mail-display.c
@@ -2874,6 +2874,7 @@ e_mail_display_set_status (EMailDisplay *display,
"<html>\n"
"<head>\n"
"<meta name=\"generator\" content=\"Evolution Mail\"/>\n"
+ "<meta name=\"color-scheme\" content=\"light dark\">\n"
"<title>Evolution Mail Display</title>\n"
"</head>\n"
"<body class=\"-e-web-view-background-color e-web-view-text-color\">"