Skip to content

Add auto, light, and dark theme modes - #8

Merged
fanis merged 1 commit into
masterfrom
claude/auto-light-dark-mode-jtiou5
Aug 9, 2026
Merged

Add auto, light, and dark theme modes#8
fanis merged 1 commit into
masterfrom
claude/auto-light-dark-mode-jtiou5

Conversation

@fanis

@fanis fanis commented Aug 9, 2026

Copy link
Copy Markdown
Owner

Adds a user-selectable theme with three modes: Auto (follow system), Light, and Dark.

Changes

  • ThemePreferences (new): stores the choice in SharedPreferences, following the existing CurrencyPreferences pattern. Defaults to Auto and falls back to Auto on unknown stored values. Also maps each mode to the UI_MODE_NIGHT_* bits it forces.
  • BaseActivity: the shared COLOR_* palette becomes per-activity fields resolved in attachBaseContext. Forced light/dark applies a uiMode configuration override, so the activity's resources (values-night theme, dialogs) and the palette follow the forced choice; Auto tracks the system setting (activities already recreate on system dark-mode changes). A dark palette variant covers background, cards, borders, text, muted/hint text, secondary-button teal, and danger red. Navigation-bar color and light-system-bar flags switch per mode, and stacked activities recreate in onResume if the theme changed while they were in the background.
  • values-night/styles.xml (new): dark Theme.Material.NoActionBar variant so AlertDialogs and window chrome go dark too.
  • SettingsActivity: new "Theme" button (below the currency picker) opening a single-choice dialog, styled like the existing currency dialog. Selecting a different mode recreates the screen immediately.

Testing

  • New ThemePreferencesRobolectricTest covering the default, persistence, invalid-value fallback, night-bit mapping, and labels.
  • Full unit-test suite passes locally (gradle testDebugUnitTest).
  • Visually verified both palettes by rendering MainActivity and SettingsActivity to PNGs via Robolectric native graphics in light and night configurations.

A new Theme setting (auto / light / dark) drives a per-activity palette
in BaseActivity: forced modes override the activity's uiMode so dialogs
and the values-night theme follow along, and auto tracks the system
setting. Stacked activities recreate on resume when the choice changes.
@fanis
fanis force-pushed the claude/auto-light-dark-mode-jtiou5 branch from faac516 to 4614756 Compare August 9, 2026 17:54
@fanis
fanis merged commit d23a7da into master Aug 9, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants