detect system dark mode

Solutions on MaxInterview for detect system dark mode by the best coders in the world

showing results for - "detect system dark mode"
Giorgio
07 Feb 2020
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)
Lawrence
31 Jun 2017
1/* Light mode */
2@media (prefers-color-scheme: light) {
3    body {
4        background-color: white;
5        color: black;
6    }
7}
8
Ivan
04 Apr 2017
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
similar questions
queries leading to this page
detect system dark mode