Add theme preference - #55
Open
alexanderpaolini wants to merge 9 commits into
Open
Conversation
Author
apex2504
requested changes
May 9, 2026
apex2504
left a comment
Member
There was a problem hiding this comment.
Good addition, thanks!
I've left a few comments on pieces of code that I'd like you to take a look at.
Also, a couple extra things need to be looked at:
-
The status bar icons can be difficult to see if the app theme does not match the system theme (you can see an example of this in your 2nd screenshot). These icons should also adjust to match.
-
Dark theme wasn't introduced officially until Android 10 but I think some Android 9 (and maybe even 8) devices support the feature to an extent. We should be making sure the device actually supports system-level dark theme before surfacing the option for it.
| const val INTERNAL_IGNORE_LIST = "internal_ignore_list" | ||
| const val AUTOPLAY_VIDEOS = "autoplay_videos" | ||
| const val UNIFIED_INFO_SHEET = "unified_info_sheet" | ||
| const val THEME = "theme" |
| val INTERNAL_IGNORE_LIST = stringSetPreferencesKey(PrefNames.INTERNAL_IGNORE_LIST) | ||
| val AUTOPLAY_VIDEOS = stringPreferencesKey(PrefNames.AUTOPLAY_VIDEOS) | ||
| val UNIFIED_INFO_SHEET = booleanPreferencesKey(PrefNames.UNIFIED_INFO_SHEET) | ||
| var THEME = stringPreferencesKey(PrefNames.THEME) |
| val autoplayVideos: AutoplayVideosMode, | ||
| val unifiedInfoSheet: Boolean | ||
| val unifiedInfoSheet: Boolean, | ||
| val theme: Theme, |
| internalIgnoreList = emptySet(), | ||
| autoplayVideos = AutoplayVideosMode.OFF, | ||
| unifiedInfoSheet = false, // Unified is called 'Classic' in the UI | ||
| theme = Theme.AUTO |
| PreferenceKeys.INTERNAL_IGNORE_LIST to PrefMeta(PrefCategory.SETTING, exportable = false), | ||
| PreferenceKeys.UNIFIED_INFO_SHEET to PrefMeta(PrefCategory.SETTING) | ||
| PreferenceKeys.UNIFIED_INFO_SHEET to PrefMeta(PrefCategory.SETTING), | ||
| PreferenceKeys.THEME to PrefMeta(PrefCategory.SETTING) |
| title = "Theme", | ||
| summary = currentSettings.theme.label, | ||
| enumItems = Theme.entries, | ||
| infoText = "Select Light or Dark to always use that theme, or Auto to follow the system theme.", |
| ) | ||
| } | ||
|
|
||
| @Composable() |
Member
There was a problem hiding this comment.
Very minor formatting thing -- parentheses unneeded
| val autoplayVideos = preferences[PreferenceKeys.AUTOPLAY_VIDEOS]?.let { AutoplayVideosMode.valueOf(it) } ?: Prefs.DEFAULT.autoplayVideos | ||
| val unifiedInfoSheet = preferences[PreferenceKeys.UNIFIED_INFO_SHEET] ?: Prefs.DEFAULT.unifiedInfoSheet | ||
|
|
||
| val theme = preferences[PreferenceKeys.THEME]?.let { Theme.valueOf(it) } ?: Prefs.DEFAULT.theme |
| autoplayVideos, | ||
| unifiedInfoSheet | ||
| unifiedInfoSheet, | ||
| theme |
| ExpressiveGroup(title = "Appearance") { | ||
| item { | ||
| EnumPref( | ||
| title = "Theme", |
Following pixel's standards
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.




This PR:
Introduces a theme selection preference that allows users to select a preferred theme. The options are
DARK,LIGHT, andAUTO.DARK: always use dark themeLIGHT: always use light themeAUTO: follow system preferences (default, old behaviour)Adds a section
Appearanceto the preferences page, with the aforementioned theme selection.