From c69843931e871badc294f07d8f70b194e6aae5ed Mon Sep 17 00:00:00 2001 From: Zak Saunders Date: Tue, 6 Dec 2022 07:22:52 +0000 Subject: [PATCH] New: Auto theme option to match OS theme Co-authored-by: Qstick --- frontend/src/Styles/Themes/index.js | 4 ++++ src/NzbDrone.Core/Configuration/ConfigFileProvider.cs | 2 +- src/NzbDrone.Core/Localization/Core/en.json | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/frontend/src/Styles/Themes/index.js b/frontend/src/Styles/Themes/index.js index 02068cc4c..d93c5dd8c 100644 --- a/frontend/src/Styles/Themes/index.js +++ b/frontend/src/Styles/Themes/index.js @@ -1,7 +1,11 @@ import * as dark from './dark'; import * as light from './light'; +const defaultDark = window.matchMedia('(prefers-color-scheme: dark)').matches; +const auto = defaultDark ? { ...dark } : { ...light }; + export default { + auto, light, dark }; diff --git a/src/NzbDrone.Core/Configuration/ConfigFileProvider.cs b/src/NzbDrone.Core/Configuration/ConfigFileProvider.cs index 6b55b6ece..ac5955069 100644 --- a/src/NzbDrone.Core/Configuration/ConfigFileProvider.cs +++ b/src/NzbDrone.Core/Configuration/ConfigFileProvider.cs @@ -206,7 +206,7 @@ namespace NzbDrone.Core.Configuration public string PostgresMainDb => _postgresOptions?.MainDb ?? GetValue("PostgresMainDb", "prowlarr-main", persist: false); public string PostgresLogDb => _postgresOptions?.LogDb ?? GetValue("PostgresLogDb", "prowlarr-log", persist: false); public int PostgresPort => (_postgresOptions?.Port ?? 0) != 0 ? _postgresOptions.Port : GetValueInt("PostgresPort", 5432, persist: false); - public string Theme => GetValue("Theme", "light", persist: false); + public string Theme => GetValue("Theme", "auto", persist: false); public bool LogSql => GetValueBoolean("LogSql", false, persist: false); public int LogRotate => GetValueInt("LogRotate", 50, persist: false); public bool FilterSentryEvents => GetValueBoolean("FilterSentryEvents", true, persist: false); diff --git a/src/NzbDrone.Core/Localization/Core/en.json b/src/NzbDrone.Core/Localization/Core/en.json index 79ea9e092..d39180ffc 100644 --- a/src/NzbDrone.Core/Localization/Core/en.json +++ b/src/NzbDrone.Core/Localization/Core/en.json @@ -404,7 +404,7 @@ "TestAllApps": "Test All Apps", "TestAllClients": "Test All Clients", "TestAllIndexers": "Test All Indexers", - "ThemeHelpText": "Change Prowlarr UI theme, inspired by {0}", + "ThemeHelpText": "Change Application UI Theme, 'Auto' Theme will use your OS Theme to set Light or Dark mode. Inspired by {0}", "Time": "Time", "Title": "Title", "Today": "Today",