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

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:43 +02:00 committed by GitHub
commit efb54324a4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

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