Add a custom color theme picker with a color wheel#482
Merged
LivingWithHippos merged 5 commits intoJul 7, 2026
Merged
Conversation
Picking a new theme now recreates the current activity right away. Since the app has two activities (MainActivity and SettingsActivity), ThemingCallback also checks on every activity resume whether the saved theme differs from what that activity was created with, and recreates it too, so MainActivity picks up the change as soon as you back out of Settings instead of needing a full app restart. Removes the now-inaccurate "restart to apply" summary and string.
…LivingWithHippos#315) Adds a wallpaper-based Material You option to the theme picker on Android 12+, using Material Components' own DynamicColors API, which overlays the device's wallpaper-derived palette on top of the app's existing Material 3 theme structure. Also fixes the actual bug reported in LivingWithHippos#315: status and navigation bar icon color was set once, statically, per day/night mode, assuming every theme gets darker at night. None of the 9 existing themes actually have night-specific colors, so the assumption doesn't hold, and the mismatch between the static assumption and each theme's real colors could make system icons invisible in either mode depending on which theme was active, not just the reporter's. Icon color is now computed from the actual applied colorPrimary/colorSurface luminance after each theme (static or dynamic) is applied, so it stays legible regardless of theme or day/night mode. While in there, rebuilt the theme picker itself as a bottom sheet instead of a plain alert dialog with a custom view. The old dialog's RecyclerView height didn't resolve reliably against the alert dialog's own ambiguous sizing, silently clipping the list short of whatever fit by coincidence, cutting off the last couple of themes together with Material You without any indication there was more below. Each theme row now also shows a check mark for the active one instead of a separate label that could overlap the list at larger font scales.
Lets the user pick any seed color from a color wheel instead of only choosing between the app's 9 fixed color themes, generating a full Material 3 palette from it the same way Material You does from the wallpaper, via DynamicColorsOptions' content-based source. There is only one custom slot: applying a new color overwrites whatever was picked before, matching how every other theme choice already works. The existing 9 themes double as quick-select swatches that seed the wheel with their primary color as a starting point, with a brightness slider alongside for the one HSV component a 2D wheel can't represent. Reworked the resume-triggered instant theme switch to compare more than just the saved style id: the custom theme always keeps the same style id no matter which seed color is active, since the color itself lives in a separate preference, so switching from one custom color to another while staying on the custom theme was invisible to the existing mismatch check and never triggered the switch to other open screens. The comparison now folds the active seed color into the signature it tracks whenever the custom theme is the one applied.
Owner
|
Nice job, I tested with an older API 27, and everything worked while the custom theme was skipped. I was fixcing the duplicated function but you were faster ;D |
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.
Lets the user pick any seed color from a color wheel instead of only choosing between the app's
9 fixed color themes, generating a full Material 3 palette from it the same way Material You
does from the wallpaper, via DynamicColorsOptions' content-based source. There is only one
custom slot: applying a new color overwrites whatever was picked before, matching how every
other theme choice already works. The existing 9 themes double as quick-select swatches that
seed the wheel with their primary color as a starting point, with a brightness slider alongside
for the one HSV component a 2D wheel can't represent.
Reworked the resume-triggered instant theme switch to compare more than just the saved style id:
the custom theme always keeps the same style id no matter which seed color is active, since the
color itself lives in a separate preference, so switching from one custom color to another while
staying on the custom theme was invisible to the existing mismatch check and never triggered the
switch on other open screens. The comparison now folds the active seed color into the signature
it tracks whenever the custom theme is the one applied.
This branch is stacked on #481 (Material You), which is itself stacked on #476 (instant theme
switch). The diff here will shrink to just this PR's changes once both merge.