Skip to content

feat(ui,sdk): Data colours scheme control — Pastel/Vivid/Muted (OB-379)#109

Merged
eliotlim merged 2 commits into
mainfrom
feat/ob-379-onto-main
Jul 6, 2026
Merged

feat(ui,sdk): Data colours scheme control — Pastel/Vivid/Muted (OB-379)#109
eliotlim merged 2 commits into
mainfrom
feat/ob-379-onto-main

Conversation

@eliotlim

@eliotlim eliotlim commented Jul 6, 2026

Copy link
Copy Markdown
Owner

Problem

OB-378 unified data colours to one soft-pastel default, but there was no way to change the scheme. Goal (OB-374) called for configurable colour schemes in Appearance. Board: OB-379.

Solution

A "Data colours" Segmented control in Appearance switches the scheme: Pastel (default) / Vivid / Muted. Switching re-colours tag chips, status lights, kit + db charts, and map pins live. CSS-var surfaces recolour for free; concrete-hex surfaces (SVG fills, Leaflet pins, kit charts) thread the active scheme via a DataSchemeProvider/useDataScheme() context. Exports inline the active scheme (self-contained; the window.__OB_DATA_SCHEME handoff is a validated enum end-to-end + clamped). New deps: none.
Reviews — Devon (design) + Quinn (code), both CLEAR-WITH-NITS, all nits applied: the Muted status trio was punched up ~12% for a clearer traffic-light; the export scheme was clamped for defense-in-depth.

Before / After

Before After
Data-colour scheme fixed (Pastel only) control: Pastel / Vivid / Muted, re-colours everything live

Light + dark, all three schemes (chips, status lights, bar chart, donut):
schemes light
schemes dark

Test procedure

  • pnpm verify green: sdk 171 · ui 937 · server 586 · e2e 251+40. Palette guard re-derives every value (incl. the punched muted status); export tests assert per-scheme hexes.
  • Appearance → Data colours → switch schemes; charts/chips/status/map recolour live and persist across reload.

Operational notes

Footer: verify green (sdk 171 · ui 937 · server 586 · mcp 40); design (Devon) + code (Quinn) gates cleared; three-scheme render owner-approved.

🤖 Generated with Claude Code

https://claude.ai/code/session_01X78XTAemKrFw1uJpDpCEaG

eliotlim and others added 2 commits July 6, 2026 08:06
…B-379)

Add a global "Data colours" appearance control that switches the data-colour
scheme (pastel default / vivid / muted) live across every data surface, and
persist it via the same appearance path as the other knobs.

- themes: `AppearanceOptions.dataColors` (default 'pastel'); `normalizeAppearance`
  fills missing → pastel and drops invalid (mirrors the sidebar knob).
- control: Segmented "Data colours" in AppearanceSettings + en.ts strings
  (appearance.dataColors{,Hint,Pastel,Vivid,Muted}); no brand names.
- reactivity: ThemeProvider calls `applyDataColors(scheme)` (CSS-var surfaces:
  chips/dots/status recolour live) and wraps a `DataSchemeProvider`. Concrete-hex
  surfaces can't read var() so they thread the active scheme: db charts
  (`chartColor(…, scheme)`), kit charts (`paletteFor(scheme)`), map pins
  (`swatchHex(…, scheme)`) via `useDataScheme()`; `swatchHex`/`seriesHex` gain a
  scheme param.
- export: toHtml/toSlideDeck/toHtmlSite thread `scheme` through RenderCtx so
  chips, status-light CSS, drawn kit charts and the live runtime inline the
  active scheme (self-contained). The viewer bundle is told the scheme via
  `window.__OB_DATA_SCHEME` (ViewerApp `DataSchemeProvider` + applyDataColors).
- tests: normalizeAppearance default/keep/drop; control switch persists +
  recolours vars; export bakes the chosen scheme.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X78XTAemKrFw1uJpDpCEaG
… review nits)

- muted status lamps: raise the LIGHT fill of green/yellow/red +12% saturation
  (hue kept) so they read as a clear red/yellow/green traffic light while staying
  in the muted family (still well below vivid). The dark fill keeps the
  desaturated wash (mode-variant for these three), and chips/series-of-other-hues
  are untouched. New light fills: green #70b88b, yellow #bfa969, red #bc6c6c.
  The dataColors drift guard's audit derivation is updated to match (Guard A green).
- export: clamp `scheme` to DATA_COLOR_SCHEMES at the entry (safeScheme) before it
  reaches `window.__OB_DATA_SCHEME`/palette lookups — JSON.stringify doesn't escape
  </script>, so this keeps the injection safe for any future unnormalized caller.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X78XTAemKrFw1uJpDpCEaG
@vercel

vercel Bot commented Jul 6, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
app.book.pub Ready Ready Preview, Comment Jul 6, 2026 12:07am

Request Review

@eliotlim eliotlim merged commit e04ba6b into main Jul 6, 2026
7 checks passed
@eliotlim eliotlim deleted the feat/ob-379-onto-main branch July 6, 2026 00:20
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