fix(configurator): lumlocker locked preview follows live sources - #634
Conversation
… stock defaults The Locked column re-derived its swatches from `overrides[src] ?? hardcoded default`, so any brand in Auto dark mode (no dark override — the default) previewed its lock from the stock blue sources: an orange brand showed blue "locked" swatches, which is impossible (the lock only pins L, never hue). Build the locked expression from the live tokens instead, mirroring the framework's core/themes.css formula exactly — including the `var(--source-dark, var(--source-light))` fallback — and resolve it per-theme through the preview iframe like the Current column. Overrides, auto-derived dark sources and the light fallback all flow through. Also NaN-guards the --sf-lumlocker read. Verified: with primary light set to oklch(0.62 0.19 45) and dark on auto, the locked D swatch resolves to oklch(0.65 0.171 45) — same hue, pinned L — where it previously showed the default blue. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013BRVgKfEYocPCHz9KU96FN
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughLumLocker now validates luminance overrides, generates locked colors from CSS variables with dark-to-light fallback behavior, and renders locked swatches through theme-aware painting. ChangesLumLocker theme resolution
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 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 |
Greptile SummaryThis PR fixes the LumLocker locked-swatch preview in the configurator's Colors panel. Previously
Confidence Score: 5/5Safe to merge — the change is purely additive to the configurator UI and touches no framework CSS tokens or shared library code. The three changes are tightly scoped: the NaN guard on lumlockerL is straightforwardly defensive, the var()-based lockedColor() correctly delegates resolution to the iframe-hosted themed probe (matching how every other swatch in the same loop already works), and paintTheme is the established mechanism for per-theme resolution throughout the panel. The dark-to-light var() fallback mirrors the framework's own CSS fallback behaviour. No regressions visible in related logic. No files require special attention. Important Files Changed
Sequence Diagram%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
participant T as Template
participant LC as lockedColor()
participant PT as paintTheme()
participant RC as resolveColorForTheme()
participant IF as Preview iframe (themed probe)
T->>LC: lockedColor(colorKey, "dark")
LC-->>T: "oklch(from var(--sf-color-{key}-source-dark,\n var(--sf-color-{key}-source-light)) 0.65 c h)"
T->>PT: paintTheme(locked, "dark", locked)
PT->>RC: resolveColorForTheme(locked, "dark")
RC->>IF: "el.style.color = locked (inside [data-theme=dark] wrapper)"
IF-->>RC: getComputedStyle().color → "oklch(0.65 0.171 45)"
RC-->>PT: "oklch(0.65 0.171 45)"
PT-->>T: "oklch(0.65 0.171 45)"
T->>T: "style="background:oklch(0.65 0.171 45)""
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
participant T as Template
participant LC as lockedColor()
participant PT as paintTheme()
participant RC as resolveColorForTheme()
participant IF as Preview iframe (themed probe)
T->>LC: lockedColor(colorKey, "dark")
LC-->>T: "oklch(from var(--sf-color-{key}-source-dark,\n var(--sf-color-{key}-source-light)) 0.65 c h)"
T->>PT: paintTheme(locked, "dark", locked)
PT->>RC: resolveColorForTheme(locked, "dark")
RC->>IF: "el.style.color = locked (inside [data-theme=dark] wrapper)"
IF-->>RC: getComputedStyle().color → "oklch(0.65 0.171 45)"
RC-->>PT: "oklch(0.65 0.171 45)"
PT-->>T: "oklch(0.65 0.171 45)"
T->>T: "style="background:oklch(0.65 0.171 45)""
Reviews (1): Last reviewed commit: "fix(configurator): lumlocker locked prev..." | Re-trigger Greptile |
Summary
Fixes the LumLocker locked-swatch preview in the configurator's Colors panel. The locked swatches were rendering stock framework defaults (blue) instead of following the live brand sources — e.g. an orange primary showed a blue "locked" swatch. The locked preview now derives its colour from the live
--sf-color-*-source-{light,dark}tokens, pinning only lightness (L) via--sf-lumlockerand preserving each source's chroma and hue.Also includes a full verification pass over every panel preview: confirmed each preview reacts to the controls that drive it (
var()-based previews viainjectLivePreview, which writes all overrides with no allowlist; schematic previews via$derivedvalues traced back tooverrides), with truthful numeric labels on the capped Layout schematics. No further changes were needed from that audit.Type
Checklist
feat:,fix:,docs:, …) — enforced by commitlintnpm run lint:csspasses (stylelint) — no CSS source touchednpm run buildrebuildsdist/— no framework/dist changescore/*.css/optional/*.css/token-registry.jsonchanges — LLM guide unaffectedNotes
Scope is
configurator/srconly. Verified in-browser: primary lightoklch(0.62 0.19 45)(orange) with auto-dark now yields locked darkoklch(0.65 0.171 45)— same hue, pinned lightness — instead of the stock blue swatch.🤖 Generated with Claude Code
Generated by Claude Code
Summary by CodeRabbit