From b4d2c11255a9525f50a46354f156af2c5390d796 Mon Sep 17 00:00:00 2001 From: Kendell R Date: Wed, 17 Aug 2022 14:36:57 -0700 Subject: [PATCH] use dark mode if the browser uses dark mode (untested) --- src/components/containers/core/Root/Root.jsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/components/containers/core/Root/Root.jsx b/src/components/containers/core/Root/Root.jsx index 91b3b6a9..9f51bf9a 100644 --- a/src/components/containers/core/Root/Root.jsx +++ b/src/components/containers/core/Root/Root.jsx @@ -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.