[evolution] I#1522 - WebView: Enable light/dark color scheme for the preview panels
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution] I#1522 - WebView: Enable light/dark color scheme for the preview panels
- Date: Wed, 21 Jul 2021 11:49:50 +0000 (UTC)
commit ab804beb518fb73c4291b5c3ee97c71d586b4410
Author: Milan Crha <mcrha redhat com>
Date: Wed Jul 21 13:47:27 2021 +0200
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
data/webkit/webview-print.css | 4 ++++
data/webkit/webview.css | 4 ++++
src/addressbook/gui/widgets/eab-contact-formatter.c | 1 +
src/calendar/gui/e-cal-component-preview.c | 1 +
src/e-util/e-web-view.c | 8 +++++---
src/em-format/e-mail-formatter-print.c | 1 +
src/em-format/e-mail-formatter.c | 2 ++
src/mail/e-mail-display.c | 1 +
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 b747c9ad19..61a516373b 100644
--- a/src/addressbook/gui/widgets/eab-contact-formatter.c
+++ b/src/addressbook/gui/widgets/eab-contact-formatter.c
@@ -52,6 +52,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\">"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]