Skip to content

Commit

Permalink
use dark mode if the browser uses dark mode (untested)
Browse files Browse the repository at this point in the history
  • Loading branch information
KTibow authored Aug 17, 2022
1 parent 3a5fb09 commit b4d2c11
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/components/containers/core/Root/Root.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,12 @@ export default class Root extends Component {
}

state = {
themeMode: readSessionCache(SESSIONSTORAGE_KEY_THEME_MODE) || MODE_BRIGHT_SNOW_FLURRY
};
themeMode:
readSessionCache(SESSIONSTORAGE_KEY_THEME_MODE) ||
(window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches
? MODE_DARK_NIGHT_FROST
: MODE_BRIGHT_SNOW_FLURRY),
};

/**
* Toggles the global theme mode and persists it in the browser's session storage.
Expand Down

0 comments on commit b4d2c11

Please sign in to comment.