fix(palette): teach the canonical SVG var() form via style=#172
Merged
Conversation
Two surfaces taught the invalid `<circle fill="var(--chart-1)">`
shape:
1. The `custom-svg` starter snippet used `fill="var(...)"` /
`stroke="var(...)"` directly. Agents extrapolated from this
example into their own SVG and shipped charts that silently fell
back to black in Safari / older Chromium (CSS `var()` is not a
valid SVG `<paint>` per the W3C spec — Chromium 113+ tolerates
it as a non-standard extension; nothing else does).
2. The `palette` MCP tool's `tokens` description told agents to
reference theme tokens "as `var(--chart-1)`, `var(--foreground)`,
… inside an `html preview` embed" with no caveat that the SVG
route specifically must go through `style="..."`.
Both fixed:
- Starter snippet now uses `style="fill: none; stroke: var(--chart-1)"`
— works in every browser, teaches the canonical W3C form.
- `palette` tool description appends a hard-stop rule for SVG, with
the working / broken pair so agents can't miss it.
Regression test in `preview-embed-starters.test.ts` greps every
starter's `<svg>` subtree for `var(...)` inside any SVG paint-
accepting presentation attribute (`fill` / `stroke` / `color` /
`stop-color` / `flood-color` / `lighting-color`); future starters
that ship the wrong shape fail with the fix locus + canonical form
in the failure message.
Closes PRD-6760.
GitOrigin-RevId: 269cb5c565fc1f6e035528bee6138d34cf59d301
Contributor
There was a problem hiding this comment.
Automated approval from agents-private public-mirror-sync (run: https://github.com/inkeep/agents-private/actions/runs/27654725561). Source of truth is the monorepo; direct edits on inkeep/open-knowledge are overwritten on next sync.
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.
No description provided.