feat(canvas): independent background selection + custom color#17
Merged
Conversation
Decouple the canvas from the visual style so any style can render on any background. The Style panel's Canvas section is now a background grid for every style (light, dark + the 12 style canvases), not just Classic, plus a Custom tile painting a solid user-chosen color. - Extract canvases into a background axis (BackgroundId, resolveCanvas); the style still sets a default and picking a style clears the override, the same way palette already works. - custom canvas: native color picker, text color + light/dark chrome derived from luminance; the color is remembered and travels in the share link only while custom is active. - Additive backgroundId / backgroundCustomColor settings — old share links render exactly as before. - Export (PNG/SVG/PDF/HTML) mirrors the chosen background. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
What
Decouple the canvas from the visual style so any style can render on any background. Answers the user request to use a style's word treatment (e.g. Bauhaus blocks) on a different canvas.
How
styles.ts:BackgroundIdaxis +BACKGROUNDScatalog derived from the style canvases;resolveCanvas()(shared by all render/export sites),computeSolidCanvas()for custom,backgroundExport(id,…)(style wrapper kept for callers/tests).schema.ts+compact-v4.ts: additivebackgroundId/backgroundCustomColor, carried in the share link (bi,bc) only when set/active.AlignmentPreview/TokenView/ExportMenu/svg.ts: render + export the resolved canvas; plain light/dark keep the preview-frame CSS path, custom is a caller-filled solid.StylePanel.svelte: background grid + custom color-input tile (native swatch styled to match the sibling tiles).Compatibility
Additive fields only — an old share link with no
backgroundIdrenders exactly as before. Note: Classic dark chosen via the grid is now an override, so it resets on a style switch (consistent with the "don't pin tweaks" rule).Verification
🤖 Generated with Claude Code