diff --git a/src/client/accounts/accounts-signature-web-view.vala b/src/client/accounts/accounts-signature-web-view.vala index d424dd64..aa1c3ae8 100644 --- a/src/client/accounts/accounts-signature-web-view.vala +++ b/src/client/accounts/accounts-signature-web-view.vala @@ -12,18 +12,23 @@ public class Accounts.SignatureWebView : Components.WebView { private static WebKit.UserScript? app_script = null; + private static WebKit.UserStyleSheet? app_stylesheet = null; public static new void load_resources() throws GLib.Error { SignatureWebView.app_script = Components.WebView.load_app_script( "signature-web-view.js" ); + SignatureWebView.app_stylesheet = Components.WebView.load_app_stylesheet( + "signature-web-view.css" + ); } public SignatureWebView(Application.Configuration config) { base(config); this.user_content_manager.add_script(SignatureWebView.app_script); + this.user_content_manager.add_style_sheet(SignatureWebView.app_stylesheet); } } diff --git a/ui/composer-web-view.css b/ui/composer-web-view.css index 98809757..6ea2caef 100644 --- a/ui/composer-web-view.css +++ b/ui/composer-web-view.css @@ -3,12 +3,22 @@ * Copyright 2017 Michael Gratton */ +:root { + /* Adjust default controls and system colors for light and dark mode. + See https://www.w3.org/TR/css-color-adjust-1/#color-scheme-effect */ + color-scheme: light dark; + + /* Apply canvas background to the root element, so body can darken + it using alpha. */ + background-color: canvas; +} + body { + background-color: rgb(50% 50% 50% / .05); + margin: 0 !important; border: 0 !important; padding: 0 !important; - color: black; - background-color: #f9f9f9; font-size: medium !important; } @@ -40,7 +50,7 @@ body > div#geary-quote { } body > div:focus-within { - background-color: white; + background-color: canvas; } body > div#geary-signature:focus-within, diff --git a/ui/conversation-web-view.css b/ui/conversation-web-view.css index eb11584b..baed4bd5 100644 --- a/ui/conversation-web-view.css +++ b/ui/conversation-web-view.css @@ -13,9 +13,10 @@ transition: height 0.25s !important; } -html { - color: black; - background-color: white; +:root { + /* Adjust default controls and system colors for light and dark mode. + See https://www.w3.org/TR/css-color-adjust-1/#color-scheme-effect */ + color-scheme: light dark; /* Width must always be defined by the viewport so content doesn't overflow inside the WebView, height must always be defined by the diff --git a/ui/org.gnome.Geary.gresource.xml b/ui/org.gnome.Geary.gresource.xml index 3e314b92..1f9ef0ca 100644 --- a/ui/org.gnome.Geary.gresource.xml +++ b/ui/org.gnome.Geary.gresource.xml @@ -49,6 +49,7 @@ gtk/help-overlay.ui password-dialog.glade problem-details-dialog.ui + signature-web-view.css signature-web-view.js geary.css single-key-shortcuts.css diff --git a/ui/signature-web-view.css b/ui/signature-web-view.css new file mode 100644 index 00000000..53813887 --- /dev/null +++ b/ui/signature-web-view.css @@ -0,0 +1,5 @@ +:root { + /* Adjust default controls and system colors for light and dark mode. + See https://www.w3.org/TR/css-color-adjust-1/#color-scheme-effect */ + color-scheme: light dark; +}