Skip to content

Rework RFC 0007 appearance model: stateful mode + dual prefs, fix persistence leak#25

Merged
willwade merged 1 commit into
mainfrom
feature/appearance-model-rework
Jun 20, 2026
Merged

Rework RFC 0007 appearance model: stateful mode + dual prefs, fix persistence leak#25
willwade merged 1 commit into
mainfrom
feature/appearance-model-rework

Conversation

@willwade

Copy link
Copy Markdown

No description provided.

…sistence leak

Review feedback (PR #24) identified three problems with the v1 stateless
"switch to my companion" design:

1. Persistence bug: dasher_set_appearance called dasher_set_palette, which
   writes the persistent SP_COLOUR_ID, so the user's explicit palette choice
   was clobbered by every auto-switch and lost across restarts.
2. No System/Light/Dark mode concept — every frontend had to reinvent the
   mode toggle.
3. 1:1 companion pairing locked users into (Rainbow <-> Rainbow Dark) with no
   way to mix e.g. Rainbow light + TurboLUT Dark.

This reworks the model to own appearance state at the C API layer (not in the
engine Parameters system — appearance is a shell/canvas concern):

- dasher_get/set_appearance_mode: SYSTEM (default) / LIGHT / DARK.
- dasher_get/set_system_appearance: transient OS appearance input (SYSTEM mode).
- dasher_get/set_light_palette + dasher_get/set_dark_palette: two independent
  persisted preferences (enables mixing).
- dasher_set_user_palette: sets the current-side pref and defaults the other
  side to the chosen palette's companion.
- Resolution (mode + system + prefs -> SP_COLOUR_ID) lives in DasherCore and
  runs at create + on every change, so dasher_get_current_palette always
  reflects the resolved palette.
- State persists to <userDir>/appearance_settings.xml (pugixml sidecar); the
  preferences — not the transient active palette — are the source of truth,
  so auto-switching can never overwrite the user's choice (bug #1 fixed).
- dasher_set_palette now routes through dasher_set_user_palette so existing
  pickers stay correct within the model. dasher_set_appearance is removed.

Kept (not redundant): the palette appearance/companion XML metadata and
dasher_get_palette_appearance / dasher_find_companion_palette — still needed
for defaulting the dark preference and grouping the picker.

Tests: mode-system, forced-mode, independent-prefs, and a persistence
regression that asserts the user's light choice survives a dark auto-switch
across a restart. Full suite green (21/21); clang-format clean.

RFC text in dasher-project/governance#9 revised to match.

Signed-off-by: will wade <willwade@gmail.com>
@willwade willwade merged commit fc61344 into main Jun 20, 2026
13 checks passed
@willwade willwade deleted the feature/appearance-model-rework branch June 20, 2026 05:10
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.

1 participant