1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 14:48:14 +00:00

Ladybird: Let WebContent know if the current system theme is dark

This means we now actually respect @media (prefers-color-scheme: dark)
by default when in dark mode. :^)
This commit is contained in:
Andreas Kling 2023-04-29 18:35:06 +02:00 committed by Jelle Raaijmakers
parent fd9b6878f6
commit 72195ade9d
3 changed files with 19 additions and 13 deletions

View file

@ -53,6 +53,8 @@
#include <QTimer>
#include <QToolTip>
bool is_using_dark_system_theme(QWidget&);
WebContentView::WebContentView(StringView webdriver_content_ipc_path, WebView::EnableCallgrindProfiling enable_callgrind_profiling)
: m_webdriver_content_ipc_path(webdriver_content_ipc_path)
{
@ -590,6 +592,8 @@ static Core::AnonymousBuffer make_system_theme_from_qt_palette(QWidget& widget,
translate(Gfx::ColorRole::Selection, QPalette::ColorRole::Highlight);
translate(Gfx::ColorRole::SelectionText, QPalette::ColorRole::HighlightedText);
palette.set_flag(Gfx::FlagRole::IsDark, is_using_dark_system_theme(widget));
return theme;
}