fix(ui): kind-less reactive-chart export uses the canonical palette (OB-380)#110
Merged
Conversation
…ette (OB-380)
Kind-less reactive charts (a chart cell with no fixed `kind`) export via
Observable Plot with no colour range set, so they picked Plot's default
categorical scheme instead of the canonical data palette the kit/db charts use.
Set the Plot `color.range` to the active scheme's `SERIES_ORDER` fills at both
export sites:
- toHtml.ts client runtime: `color:{range:KIT_PALETTE,...}` — reuses the
`KIT_PALETTE` const already prepended by `kitChartRuntime(scheme)`, so the
scheme's fills are inlined (self-contained; no live CSS vars or app modules).
- chartSvg.ts server SVG: `color:{range:paletteFor(scheme),...}` via a new
`scheme` param, reusing the canonical `paletteFor` (no re-literal).
An exported kind-less chart now colour-matches in-app and honours the selected
Pastel/Vivid/Muted scheme. Extends exportReactive tests to assert the Plot range
resolves to the canonical fills (pastel lead #a9ccdf, vivid #3b82f6).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X78XTAemKrFw1uJpDpCEaG
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Kind-less reactive charts (a chart cell with no fixed
kind) exported via Observable Plot with no colour range set, so they fell back to Plot's default categorical scheme — not the canonical data palette. An exported reactive chart didn't colour-match the app or the other chart types. Board: OB-380 (follow-up to OB-378, flagged by Devon).Solution
Set the Plot
colorscale'srangeto the canonical palette for the active scheme, in both export sites:toHtml.ts(client runtime):color:{range:KIT_PALETTE,legend:…}—KIT_PALETTEis already prepended bykitChartRuntime(scheme), so it's inlined + self-contained + honours the exporting user's Pastel/Vivid/Muted scheme.chartSvg.ts(server SVG):color:{range:paletteFor(scheme),…}+ aschemeparam.One palette source shared with the kit/db charts; no re-literal. New deps: none.
Before / After
saturated, mismatched
soft pastel, matches in-app
Test procedure
pnpm verifygreen: sdk 171 · ui 939 · server 586.exportReactive.test.tsextended (2 tests): server SVG emitsstroke="#a9ccdf"/#debea6/#9fdf9f(pastel lead trio) +#3b82f6(vivid); runtime containscolor:{range:KIT_PALETTE…}+ the inlinedconst KIT_PALETTE=["#a9ccdf"….Operational notes
buildChartSvghas no in-repo callers (residual exported API from the pre-block-native PDF path) — fixed anyway for consistency.chore/artifacts.Footer: verify green (sdk 171 · ui 939 · server 586);
designgate → Devon.🤖 Generated with Claude Code
https://claude.ai/code/session_01X78XTAemKrFw1uJpDpCEaG