From 79d77f60df0d1fbddf7f9f8d6aaa334b920958f7 Mon Sep 17 00:00:00 2001 From: shilangyu Date: Wed, 28 Apr 2021 14:39:31 +0200 Subject: [PATCH] Add browser theme detection --- lib/stores/config_store.dart | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/stores/config_store.dart b/lib/stores/config_store.dart index 194357a..9378fb4 100644 --- a/lib/stores/config_store.dart +++ b/lib/stores/config_store.dart @@ -95,9 +95,15 @@ class ConfigStore extends ChangeNotifier { }; _showAvatars = localUserSettings.showAvatars; - _theme = darkModeLemmyUiThemes.contains(localUserSettings.theme) - ? ThemeMode.dark - : ThemeMode.light; + _theme = () { + if (localUserSettings.theme == 'browser') return ThemeMode.system; + + if (darkModeLemmyUiThemes.contains(localUserSettings.theme)) { + return ThemeMode.dark; + } + + return ThemeMode.light; + }(); _locale = L10n.supportedLocales.contains(Locale(localUserSettings.lang)) ? Locale(localUserSettings.lang) : _locale;