“Systemdunkler Modus erkennen” Code-Antworten

Fenster erkennen das System Dunkelmodus

RegGetValueA - gets a value from the registry (winreg.h)
use it to retrieve this key:
HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize\AppsUseLightTheme
res == ERROR_SUCCESS && data == 0 = dark mode
otherwise = light mode (1 is light and fallback should be light)
Stormy Salmon

Systemdunkler Modus erkennen

/* Light mode */
@media (prefers-color-scheme: light) {
    body {
        background-color: white;
        color: black;
    }
}
flexflower

Systemdunkler Modus erkennen

/* Light mode, Dark mode is below... 
Standard is registered on W3C in Media Queries Level 5:
https://drafts.csswg.org/mediaqueries-5/#prefers-color-scheme
*/

@media (prefers-color-scheme: light) {
    body {
        background-color: white;
        color: black;
    }
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
    body {
        background-color: black;
        color: white;
    }
}
Yellowed Yak

Ähnliche Antworten wie “Systemdunkler Modus erkennen”

Fragen ähnlich wie “Systemdunkler Modus erkennen”

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen