1RegGetValueA - gets a value from the registry (winreg.h)
2use it to retrieve this key:
3HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize\AppsUseLightTheme
4res == ERROR_SUCCESS && data == 0 = dark mode
5otherwise = light mode (1 is light and fallback should be light)
1/* Light mode */
2@media (prefers-color-scheme: light) {
3 body {
4 background-color: white;
5 color: black;
6 }
7}
8
1/* Light mode, Dark mode is below...
2Standard is registered on W3C in Media Queries Level 5:
3https://drafts.csswg.org/mediaqueries-5/#prefers-color-scheme
4*/
5
6@media (prefers-color-scheme: light) {
7 body {
8 background-color: white;
9 color: black;
10 }
11}
12
13/* Dark mode */
14@media (prefers-color-scheme: dark) {
15 body {
16 background-color: black;
17 color: white;
18 }
19}
20