Respect system colour scheme for title bar colour (#109)

This commit is contained in:
Hyper
2025-01-17 15:08:52 +00:00
committed by GitHub
parent 7c60e47eee
commit f8e6b74551
9 changed files with 68 additions and 13 deletions

View File

@@ -0,0 +1,6 @@
#include <os/user_detail.h>
bool os::user::detail::IsDarkTheme()
{
return false;
}

View File

@@ -0,0 +1,7 @@
#include <os/user.h>
#include <os/user_detail.h>
bool os::user::IsDarkTheme()
{
return detail::IsDarkTheme();
}

View File

@@ -0,0 +1,6 @@
#pragma once
namespace os::user
{
bool IsDarkTheme();
}

View File

@@ -0,0 +1,6 @@
#pragma once
namespace os::user::detail
{
bool IsDarkTheme();
}

View File

@@ -0,0 +1,23 @@
#include <os/user_detail.h>
bool os::user::detail::IsDarkTheme()
{
HKEY hKey;
if (RegOpenKeyExA(HKEY_CURRENT_USER, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize", 0, KEY_READ, &hKey) == ERROR_SUCCESS)
{
DWORD value = 0;
DWORD valueSize = sizeof(value);
if (RegQueryValueExA(hKey, "AppsUseLightTheme", nullptr, nullptr, (LPBYTE)&value, &valueSize) == ERROR_SUCCESS)
{
RegCloseKey(hKey);
return value == 0;
}
RegCloseKey(hKey);
}
return false;
}