Skip to content

Commit 814c4df

Browse files
committed
The first stage of applying dark mode
1 parent bdff2dc commit 814c4df

File tree

5 files changed

+602
-40
lines changed

5 files changed

+602
-40
lines changed

src/registry.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,17 @@ static __inline BOOL WriteRegistryKey32(HKEY root, const char* key, int32_t val)
202202
DWORD tmp = (DWORD)val;
203203
return SetRegistryKey32(root, key, tmp);
204204
}
205+
static __inline BOOL IsAppsUseDarkMode() {
206+
char buffer [4] ;
207+
DWORD cbData = (DWORD)(sizeof(buffer));
208+
LSTATUS res = RegGetValue(REGKEY_HKCU, L"Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize", L"AppsUseLightTheme", RRF_RT_REG_DWORD, NULL, buffer, &cbData);
209+
if (res == ERROR_SUCCESS)
210+
{
211+
int i = (int)(buffer[3] << 24 | buffer[2] << 16 | buffer[1] << 8 | buffer[0]);
212+
return i == 0;
213+
}
214+
return FALSE;
215+
}
205216

206217
/* Helpers for boolean registry operations */
207218
#define ReadRegistryKeyBool(root, key) (ReadRegistryKey32(root, key) != 0)

0 commit comments

Comments
 (0)