Skip to content

Fix custom palette save mechanics and add direct background control#168

Draft
mapgie wants to merge 1 commit into
mainfrom
claude/colour-theme-settings-analysis-xattai
Draft

Fix custom palette save mechanics and add direct background control#168
mapgie wants to merge 1 commit into
mainfrom
claude/colour-theme-settings-analysis-xattai

Conversation

@mapgie

@mapgie mapgie commented Jul 9, 2026

Copy link
Copy Markdown
Owner

Summary

GoFlo's custom theme is the strongest of the four apps (exact picked colours, HSV square + hex picker, contrast-aware on-colours), so this PR only closes its remaining gaps: janky save mechanics and no direct background control.

Changes

Save mechanics (SettingsScreen.kt, SettingsViewModel.kt)

  • "Save palette" always created a duplicate row, so iterating on colours multiplied palettes. With an active saved palette the save row now offers Update (overwrites in place via the new updateColorProfile) and Save as new; without one it stays a single "Save palette" action.
  • renameColorProfile existed in the ViewModel but nothing called it. Each saved palette row gains a rename button that opens a rename dialog.
  • Deleting the active palette now clears customActiveProfileId instead of leaving a dangling pointer. The working colours stay applied, since they live in DataStore rather than the deleted row.

Direct background control (Color.kt, Theme.kt, ReminderPreferences.kt, MainActivity.kt)

  • New "Background (light)" and "Background (dark)" rows in the custom section, using the existing ColorPickerDialog. Overrides are ARGB with 0 = Auto (the previous derive-from-primary-hue behaviour), plus an explicit Auto reset.
  • buildCustomColorScheme gains a backgroundArgb parameter: the picked background is applied exactly, and the neutral tokens (onBackground/surface/surfaceVariant/outline/inverse) re-derive from it by relative luminance so text stays legible. When Auto, every token keeps its existing hue-derived value, so current users see no change.
  • Overrides are saved with palettes and restored on load (color_profiles v21 → v22, two additive columns with defaults; no destructive migration).

Preview accuracy

  • The swatch for an unpicked colour slot used HSV S=1.0/V=0.8 while the builder's fallback is HSL 0.60/0.35, so the row previewed a colour the theme never renders. The fallback now resolves through the same values as the builder.

Changelog fragment: changelog/unreleased/custom-palette-mechanics.json (minor).

a11y_check.py passes (92 files, clean).

Companion PRs: mapgie/Android-App-Template#24, mapgie/choreDash-Android#81 (both adopt GoFlo's picker model), GaMeD PR to follow.

🤖 Generated with Claude Code

https://claude.ai/code/session_01YEGQ585q9wtogd9G1v7Ef1


Generated by Claude Code

Saving always created a duplicate profile (no update-in-place), the
rename function existed but had no UI, deleting the active profile left
a dangling active-profile pointer, and the swatch shown for an unpicked
colour slot used different saturation/brightness than the theme builder
actually applies. Backgrounds were derived from the primary hue with no
way to change them directly.

- With an active saved palette the save row now offers "Update"
  (overwrites in place) and "Save as new"; without one it stays a
  single "Save palette" action.
- Each saved palette row gains a rename button wiring up the previously
  unused renameColorProfile.
- Deleting the active palette clears the active pointer; the working
  colours stay applied since they live in DataStore.
- New "Background (light)" and "Background (dark)" rows override the
  derived background via the existing colour picker dialog, with an
  Auto reset. Overrides are stored in preferences and in saved palettes
  (Room v21 -> v22 additive migration); text and neutral tokens
  re-derive from the picked background so they stay legible.
- Unpicked colour slots now preview the builder's actual hue fallback
  (HSL 0.60/0.35) instead of an oversaturated HSV placeholder.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YEGQ585q9wtogd9G1v7Ef1
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