Skip to content

Apply custom colours faithfully, add WCAG palettes and background control#81

Merged
mapgie merged 1 commit into
mainfrom
claude/colour-theme-settings-analysis-xattai
Jul 10, 2026
Merged

Apply custom colours faithfully, add WCAG palettes and background control#81
mapgie merged 1 commit into
mainfrom
claude/colour-theme-settings-analysis-xattai

Conversation

@mapgie

@mapgie mapgie commented Jul 9, 2026

Copy link
Copy Markdown
Owner

Summary

This fixes the "colours are always murky and the settings don't do anything" problem at its root, and closes the feature gaps against GoFlo and the template.

Why custom themes looked murky: buildCustomColorScheme clamped or discarded most of what the user picked. In dark mode the primary's lightness was hardcoded to 0.75 and its saturation capped at 0.55 (secondary/tertiary capped even harder), so every dark custom theme converged on the same pastel wash regardless of the sliders. In light mode the role colours survived, but all containers, surfaces, and backgrounds used fixed low saturations, so the overall look barely changed. The picker swatches drew the raw HSL values, which the applied theme then didn't use — hence "picked colours don't match the theme".

Changes

Theme engine (Color.kt, Theme.kt)

  • Picked colours are applied verbatim to primary/secondary/tertiary in both light and dark mode. On-colours are chosen by relative luminance (near-black on bright picks, white on dark picks) so legibility is solved on the derived colours instead of by constraining the pick.
  • Backgrounds are user-controllable: new per-mode overrides (Background (light) / Background (dark)) with an Auto option that keeps the old derive-from-primary-hue behaviour. Neutrals (surfaceVariant, outline, inverse surfaces) derive from whichever background is in effect.
  • New WCAG accessible colours toggle for the built-in palettes (Mist/Sage/Coral/Teal). Variants are derived programmatically: accent roles are stepped to at least 7:1 contrast against the background, supporting text to 7:1, outlines to 4.5:1. Hidden while Custom is active since custom on-colours are already luminance-guarded.

Picker UI (CompactThemePicker.kt, new ColorPickerDialog.kt)

  • The three stacked HSL slider groups (9 raw sliders) are replaced by one row per colour role that opens a full colour picker dialog: HSV saturation/brightness square, hue bar, and hex entry — the same picker style as GoFlo, ported via the template. Colours are still persisted as HSL, so existing DataStore values carry over unchanged.

Saved themes (SavedThemesList.kt, SettingsViewModel.kt, Room v2 → v3)

  • Tapping a saved theme row now loads it (was a no-op with actions buried in small icon buttons).
  • Profiles record the brightness mode they were saved under and restore it on load; the mode column was previously always written "LIGHT" and never read despite its docs promising faithful restore.
  • Deleting the active profile clears only the active pointer instead of resetting the whole app to Mist.
  • Additive migration adds the two background-override columns (defaults 0 = Auto); no destructive migration.

Docs

  • CLAUDE.md architecture notes corrected: the repo does have a Room database (saved themes only), and the theme is no longer "a single sage-green palette".
  • LESSONS.md entry on why theme builders must not clamp user input and why previews must resolve through the builder's code path.

Changelog fragment: changelog/unreleased/custom-theme-overhaul.json (minor).

a11y_check.py passes (71 files, clean).

Companion PRs: mapgie/Android-App-Template#24 (canonical custom colour model), GoFlo and GaMeD PRs to follow.

🤖 Generated with Claude Code

https://claude.ai/code/session_01YEGQ585q9wtogd9G1v7Ef1


Generated by Claude Code

…trol

The custom theme discarded most of what the user picked: dark mode
hardcoded primary lightness to 0.75 and clamped saturation, so every
dark custom theme converged on the same pastel wash, and the picker
swatches never matched the applied theme. There was also no
high-contrast option, backgrounds could not be changed directly, and
the saved-theme mechanics were janky.

- Custom colours are now applied verbatim to their roles in both light
  and dark mode; on-colours are chosen by relative luminance so text
  stays legible on any pick. Containers and neutrals derive from the
  picked hues with mode-appropriate lightness.
- The raw HSL slider stacks are replaced by one row per colour role
  opening a shared colour picker dialog (HSV square, hue bar, hex
  entry), matching the picker style used in GoFlo.
- New "Background (light)" and "Background (dark)" rows override the
  derived background, with an Auto reset (stored as ARGB, 0 = auto;
  Room v2 -> v3 additive migration for saved profiles).
- New "WCAG accessible colours" toggle derives high-contrast variants
  of the built-in palettes programmatically (accents pushed to 7:1
  against the background, outlines to 4.5:1), hidden while Custom is
  active since custom on-colours are already luminance-guarded.
- Saved themes: tapping a row loads it; profiles record the brightness
  mode they were saved under and restore it on load (the mode column
  was previously always written "LIGHT" and never read); deleting the
  active profile no longer resets the app to Mist.
- Fix CLAUDE.md architecture drift ("no local database", "single sage
  palette") and add a LESSONS.md entry on theme-builder clamping.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YEGQ585q9wtogd9G1v7Ef1
@mapgie mapgie marked this pull request as ready for review July 10, 2026 14:03
@mapgie mapgie merged commit dc9048f into main Jul 10, 2026
4 checks passed
@mapgie mapgie deleted the claude/colour-theme-settings-analysis-xattai branch July 10, 2026 14:03
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