Skip to content

Commit b4d2c11

Browse files
authored
use dark mode if the browser uses dark mode (untested)
1 parent 3a5fb09 commit b4d2c11

File tree

1 file changed

+6
-2
lines changed
  • src/components/containers/core/Root

1 file changed

+6
-2
lines changed

src/components/containers/core/Root/Root.jsx

+6-2
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,12 @@ export default class Root extends Component {
8080
}
8181

8282
state = {
83-
themeMode: readSessionCache(SESSIONSTORAGE_KEY_THEME_MODE) || MODE_BRIGHT_SNOW_FLURRY
84-
};
83+
themeMode:
84+
readSessionCache(SESSIONSTORAGE_KEY_THEME_MODE) ||
85+
(window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches
86+
? MODE_DARK_NIGHT_FROST
87+
: MODE_BRIGHT_SNOW_FLURRY),
88+
};
8589

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

0 commit comments

Comments
 (0)