feat(webcomponent): add color-scheme attribute#2955
Conversation
Add 'color-scheme' as an observed attribute on the <likec4-view> web component, allowing users to force 'light' or 'dark' color scheme. Without this attribute, the component follows the system/browser preference. Fixes likec4#2954
🦋 Changeset detectedLatest commit: 61dd92d The changes in this PR will be included in the next version bump. This PR includes changesets to release 22 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
📝 WalkthroughWalkthroughThis PR exposes a new ChangesColor-scheme Web Component Support
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested reviewers
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
davydkov
left a comment
There was a problem hiding this comment.
@dkapitan please add changeset file, it is needed for generated release notes (you can ask changeset-generator agent)
Summary
Add
color-schemeas an observed attribute on the<likec4-view>web component, allowing users to forcelightordarkcolor scheme explicitly.Problem
The
<likec4-view>web component only exposesview-id,browser, anddynamic-variantas attributes. The underlying ReactLikeC4Viewcomponent supports acolorSchemeprop, but it's not wired through the web component. This means users embedding diagrams in light-themed pages (e.g. Quarto books) get dark backgrounds with no way to override.Solution
color-schemetoobservedAttributescolorSchemeto the Zod props schema as an optional literal['light', 'dark']color-schemeattribute through to the React componentUsage
When omitted, behavior is unchanged (follows system preference).
Fixes #2954