diff options
author | networkException <git@nwex.de> | 2022-07-31 23:38:55 +0200 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2022-08-01 00:20:43 +0200 |
commit | f722612e177b6d715e814b9cdc4139abbaf4061b (patch) | |
tree | 504550dcee9ca0c8ff80ade047313d9720c18f8d /Userland/Applications/Browser/Tab.cpp | |
parent | ea9ef33a7f7b08fdd2a350d55cb4bd116e667b16 (diff) | |
download | serenity-f722612e177b6d715e814b9cdc4139abbaf4061b.zip |
Browser: Set preferred color scheme when constructing a tab
Previously we would only tell OutOfProcessWebView about the preferred
color scheme when changing it in the browser's settings.
This patch implements reading in the current config value to set the
scheme immediately :^)
See SerenityOS update (July 2022) https://youtu.be/aO0b2X7tzuk?t=2171
Diffstat (limited to 'Userland/Applications/Browser/Tab.cpp')
-rw-r--r-- | Userland/Applications/Browser/Tab.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Userland/Applications/Browser/Tab.cpp b/Userland/Applications/Browser/Tab.cpp index 89c33cc29e..12d5bc3bcc 100644 --- a/Userland/Applications/Browser/Tab.cpp +++ b/Userland/Applications/Browser/Tab.cpp @@ -19,6 +19,7 @@ #include <AK/StringBuilder.h> #include <AK/URL.h> #include <Applications/Browser/TabGML.h> +#include <LibConfig/Client.h> #include <LibGUI/Action.h> #include <LibGUI/Application.h> #include <LibGUI/BoxLayout.h> @@ -114,6 +115,10 @@ Tab::Tab(BrowserWindow& window) auto& webview_container = *find_descendant_of_type_named<GUI::Widget>("webview_container"); m_web_content_view = webview_container.add<WebView::OutOfProcessWebView>(); + + auto preferred_color_scheme = Web::CSS::preferred_color_scheme_from_string(Config::read_string("Browser"sv, "Preferences"sv, "ColorScheme"sv, "auto"sv)); + m_web_content_view->set_preferred_color_scheme(preferred_color_scheme); + if (g_content_filters_enabled) m_web_content_view->set_content_filters(g_content_filters); else |