mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-04-26 22:38:34 +00:00
DolphinQt: Switch dark/light theme when Windows theme changes.
This commit is contained in:
parent
e2fb8fab2f
commit
250d5f55de
5 changed files with 49 additions and 16 deletions
|
@ -19,6 +19,8 @@
|
|||
|
||||
#include <fmt/format.h>
|
||||
|
||||
#include <winrt/Windows.UI.ViewManagement.h>
|
||||
|
||||
#include <QTabBar>
|
||||
#include <QToolButton>
|
||||
#endif
|
||||
|
@ -127,6 +129,22 @@ QString Settings::GetCurrentUserStyle() const
|
|||
return QFileInfo(GetQSettings().value(QStringLiteral("userstyle/path")).toString()).fileName();
|
||||
}
|
||||
|
||||
void Settings::UpdateSystemDark()
|
||||
{
|
||||
#ifdef _WIN32
|
||||
// Check if the system is set to dark mode so we can set the default theme and window
|
||||
// decorations accordingly.
|
||||
{
|
||||
using namespace winrt::Windows::UI::ViewManagement;
|
||||
const UISettings settings;
|
||||
const auto& color = settings.GetColorValue(UIColorType::Foreground);
|
||||
|
||||
const bool is_system_dark = 5 * color.G + 2 * color.R + color.B > 8 * 128;
|
||||
Settings::Instance().SetSystemDark(is_system_dark);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void Settings::SetSystemDark(bool dark)
|
||||
{
|
||||
s_system_dark = dark;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue