MCPcopy Create free account
hub / github.com/PenguLoader/PenguLoader / is_dark_theme

Method is_dark_theme

core/src/utils/window.cc:196–214  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

194}
195
196bool window::is_dark_theme()
197{
198 char buffer[4]{};
199 DWORD cbData = sizeof(buffer);
200 auto res = _getfunc<decltype(&RegGetValueW)>("advapi32.dll", "RegGetValueW")(HKEY_CURRENT_USER,
201 L"Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize",
202 L"AppsUseLightTheme", RRF_RT_REG_DWORD,
203 nullptr, buffer, &cbData);
204
205 if (res != ERROR_SUCCESS)
206 return false;
207
208 auto i = int(buffer[3] << 24 |
209 buffer[2] << 16 |
210 buffer[1] << 8 |
211 buffer[0]);
212
213 return i != 1;
214}
215
216void window::set_theme(void *hwnd, bool dark)
217{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected