Add base color palette and live semantic preview to ColorsPanel - #461
Conversation
Base color no longer rides the color-mix tint/shade curve used by the five brand colors — it's an absolute fixed-lightness OKLCH ramp (oklch(from <base> <L> c h)). Give it a matching preview in the control panel: - Add BASE_RAMP mirroring the L values in core/tokens.css and a computeBasePaletteSwatch() that reproduces the framework's ramp. - Route palette strips through a paletteSwatch() helper so base uses its ramp while the brand colors keep the mix curve, and include base in the rendered light/dark strips with a short explanatory note. Status colors now expose the same Auto/Manual dark toggle as the brand colors, defaulting to Auto (matching the CSS light-dark fallback that auto-derives the dark source). Seed autoDarkSet and toggleDarkMode from the combined brand + status source list. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GDdMto9ikgPJJ5PbbwP4BA
Add an always-visible preview at the top of the Colors panel showing every semantic role — brand, status, and surfaces/text — each tile painted with the resolved background and its paired on-color text, so it doubles as a quick legibility check. Resolved from the live canvas via paint(), so it tracks overrides and the active theme in real time. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GDdMto9ikgPJJ5PbbwP4BA
Split the top-of-panel semantic preview into labelled L/D rows per group, resolving each tile through paintTheme() for both light and dark instead of only the canvas's active theme. Both modes update live as you edit. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GDdMto9ikgPJJ5PbbwP4BA
|
Warning Review limit reached
Next review available in: 52 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthrough
ColorsPanel enhancements
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested labels
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
PR Summary by QodoAdd base color ramp + live semantic preview to ColorsPanel
AI Description
Diagram
High-Level Assessment
Files changed (1)
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@configurator/src/components/panels/ColorsPanel.svelte`:
- Around line 402-403: The dark-value derivation in ColorsPanel.svelte is using
the fallback default source instead of the loaded token source, which can
produce a mismatched manual dark override and preview. Update the dark
derivation paths in the relevant colors panel helpers (the ones currently
calling deriveDarkFromLight from the light token selection) to read the source
value through sourceTokenMap consistently, matching the logic already used in
the later auto-preview code. Keep the same symbols involved in this flow,
including ALL_SOURCES, sourceTokenMap, deriveDarkFromLight, and the dark/manual
toggle handlers, so the derived dark value always comes from the actual loaded
token value.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 15cea607-4a57-4447-beca-552e5adcb550
📒 Files selected for processing (1)
configurator/src/components/panels/ColorsPanel.svelte
Code Review by Qodo
Context used✅ Compliance rules (platform):
6 rules 1.
|
…ault The Auto→Manual seed in toggleDarkMode and the read-only "auto-derived" dark previews derived from `overrides[light] ?? hardcoded default`, skipping the loaded token value in sourceTokenMap that the swatch strips and inputs already use. When a light source token's current value differed from the hardcoded default, the seeded manual override and the inline preview could disagree with the rest of the panel. Add a sourceValue() helper applying the panel-wide precedence (override → loaded token value → default) and route every source-value read through it, so derivation, seeding, swatches, and inputs stay consistent. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GDdMto9ikgPJJ5PbbwP4BA
Summary
Extends the ColorsPanel with support for the new
basecolor system and adds a live semantic color preview section at the top of the panel. Thebasecolor now uses an absolute fixed-lightness OKLCH ramp (independent of the brand color mix curve), and all semantic roles are previewed in real-time with their paired on-color text for legibility checking.Key changes
Base color palette system: Added
BASE_RAMPconstant with fixed lightness values for each step (50–950), mirroring the framework's absolute OKLCH ramp. Base colors now pin lightness and inherit chroma + hue from the source, unlike the brand colors which use the color-mix tint/shade curve.Palette routing: Introduced
paletteSwatch()function that routes each color to the correct palette system—base uses the fixed-L ramp, all others use the color-mix curve toward surface/text.Live semantic preview: Added
SEMANTIC_PREVIEWsection at the top showing all semantic roles (brand, status, surfaces & text) rendered in both light and dark modes with their resolved on-color text. Each tile is painted from the live canvas, so it updates as you edit and serves as a real legibility check.Expanded color tracking: Renamed
BRAND_COLOR_KEYSusage toPALETTE_COLOR_KEYS(which includes base) and movedALL_SOURCESto module scope for consistent access across auto-dark logic.Auto/manual dark mode toggle for status colors: Status color pairs now have an explicit toggle button to switch between auto-derived and manual dark values, with visual feedback. Auto mode shows the derived value inline; manual mode reveals the editable dark input.
Improved dark value derivation: Status colors now properly use
sourceTokenMapto resolve token values before deriving dark, ensuring consistency with brand colors. Auto-derived dark values are displayed as read-only previews when in auto mode.Base color documentation: Added inline help text explaining that base uses an absolute lightness ramp, not the brand mix curve.
Implementation notes
BASE_RAMPvalues are hardcoded to matchcore/tokens.cssexactly, ensuring the panel preview matches the framework output.computeBasePaletteSwatch()usesoklch(from <source> <L> c h)syntax to pin lightness while inheriting chroma and hue.paintTheme()to resolve colors from the live canvas, so it reflects both overrides and the active theme in real-time.autoDarkSet, with proper initialization from existing overrides.https://claude.ai/code/session_01GDdMto9ikgPJJ5PbbwP4BA
Summary by CodeRabbit
New Features
Improvements