Skip to content

2026.08.24 - Custom Colours - Phase 1: Catalogue and Config - #89

Merged
lanhhoang merged 3 commits into
masterfrom
20260824-custom-colours-phase-1-catalog-config
Aug 24, 2026
Merged

lanhhoang merged 3 commits into
masterfrom
20260824-custom-colours-phase-1-catalog-config

Conversation

@lanhhoang

Copy link
Copy Markdown
Contributor
  • Add the colour preset catalogue, the canonical ColorSettings contract, and the config load/save wiring that all later renderers consume.

Adds the 8 fixed preset palettes plus the live Pi default and the
Custom user override, defines the 14-role semantic palette contract
shared with SidebarSegmentRole, and threads ColorSettings through
the load/save path so all renderers consume one normalized object.

- src/core/colors.ts: ATELIER_COLORS, FIXED_COLOR_PALETTES,
  COLOR_PRESET_IDS, DEFAULT_COLOR_SETTINGS, plus validation
  helpers (isHexColor, normalizeHexColor) and canonicalization
  (getFixedColorPalette, normalizeColorSettings).
- src/shared/types.ts: PALETTE_ROLES, PaletteRole, ColorPreset,
  FixedColorPreset, HexColor, ColorPalette, ColorSettings; aliases
  SidebarSegmentRole = PaletteRole; requires colors on
  PiStatusConfig.
- src/core/config.ts: default/clone/normalize/save now round-trip
  colors via normalizeColorSettings so JavaScript callers cannot
  persist uppercase, mixed-case, partial, or unknown colour data.
- Test fixtures: every typed PiStatusConfig literal now includes
  colors: structuredClone(DEFAULT_COLOR_SETTINGS) so the required
  field is satisfied.
- tests/core/config.test.ts: focused failing-test-first describe
  block pins preset/role order, default fallback, malformed-input
  repair, case-insensitive hex acceptance, round-trip, frozen
  catalogue, and save-side canonicalization.
Updates four exact-default expectations and the published-keys list in
tests/core/config.test.ts so they accept the new required colors
field on PiStatusConfig and include "colors" in the persisted schema
key set. This is a fixture-only follow-up to the previous commit that
introduced ColorSettings.
@lanhhoang
lanhhoang merged commit a885a5d into master Aug 24, 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.

1 participant