fix: system accent color parsing hex order (#48108)

fix: system accent color parsing

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
This commit is contained in:
trop[bot]
2025-08-19 12:45:57 +02:00
committed by GitHub
parent 3e0378340e
commit 37b5a62daa

View File

@@ -12,6 +12,8 @@
#if BUILDFLAG(IS_WIN)
#include <dwmapi.h>
#include "base/win/registry.h"
#endif
namespace {
@@ -68,12 +70,18 @@ std::string ToRGBAHex(SkColor color, bool include_hash) {
#if BUILDFLAG(IS_WIN)
std::optional<DWORD> GetSystemAccentColor() {
DWORD color = 0;
BOOL opaque = FALSE;
if (FAILED(DwmGetColorizationColor(&color, &opaque)))
base::win::RegKey key;
if (key.Open(HKEY_CURRENT_USER, L"SOFTWARE\\Microsoft\\Windows\\DWM",
KEY_READ) != ERROR_SUCCESS) {
return std::nullopt;
return color;
}
DWORD accent_color = 0;
if (key.ReadValueDW(L"AccentColor", &accent_color) != ERROR_SUCCESS) {
return std::nullopt;
}
return accent_color;
}
#endif