Skip to content

Commit

Permalink
New: Auto theme option to match OS theme
Browse files Browse the repository at this point in the history
Closes #2022

Co-authored-by: Qstick <qstick@gmail.com>
(cherry picked from commit 4ca5a213fa0fc29ed93e7e31b080728d6fa7f1f3)
  • Loading branch information
thezak48 authored and Qstick committed Jan 24, 2023
1 parent 8a4d309 commit ed1b29f
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
4 changes: 2 additions & 2 deletions frontend/src/Settings/UI/UISettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,11 +186,11 @@ class UISettings extends Component {
legend={translate('Style')}
>
<FormGroup>
<FormLabel>Theme</FormLabel>
<FormLabel>{translate('Theme')}</FormLabel>
<FormInputGroup
type={inputTypes.SELECT}
name="theme"
helpText="Change Application UI Theme, Inspired by Theme.Park"
helpText={translate('ThemeHelpText')}
values={themeOptions}
onChange={onInputChange}
{...settings.theme}
Expand Down
4 changes: 4 additions & 0 deletions frontend/src/Styles/Themes/index.js
Original file line number Diff line number Diff line change
@@ -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
};
2 changes: 1 addition & 1 deletion src/NzbDrone.Core/Configuration/ConfigFileProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ public AuthenticationType AuthenticationMethod
public string PostgresCacheDb => _postgresOptions?.CacheDb ?? GetValue("PostgresCacheDb", "readarr-cache", 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);
Expand Down
2 changes: 2 additions & 0 deletions src/NzbDrone.Core/Localization/Core/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -770,6 +770,8 @@
"TheAuthorFolderAndAllOfItsContentWillBeDeleted": "The author folder {0} and all of its content will be deleted.",
"TheBooksFilesWillBeDeleted": "The book's files will be deleted.",
"TheFollowingFilesWillBeDeleted": "The following files will be deleted:",
"Theme": "Theme",
"ThemeHelpText": "Change Application UI Theme, 'Auto' Theme will use your OS Theme to set Light or Dark mode. Inspired by Theme.Park",
"ThisCannotBeCancelled": "This cannot be cancelled once started without disabling all of your indexers.",
"ThisWillApplyToAllIndexersPleaseFollowTheRulesSetForthByThem": "This will apply to all indexers, please follow the rules set forth by them",
"Time": "Time",
Expand Down

0 comments on commit ed1b29f

Please sign in to comment.