Skip to content
This repository has been archived by the owner on Feb 4, 2023. It is now read-only.

Commit

Permalink
Add browser theme detection
Browse files Browse the repository at this point in the history
  • Loading branch information
shilangyu committed Apr 28, 2021
1 parent efb7736 commit 79d77f6
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions lib/stores/config_store.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 79d77f6

Please sign in to comment.