chore(plugin-vscode): migrate to OKLCH (color → culori)#759
chore(plugin-vscode): migrate to OKLCH (color → culori)#759paanSinghCoder wants to merge 2 commits intomainfrom
Conversation
Convert all 157 token color values across the plugin's TS data files to oklch() strings, matching the apsara CSS token format. Mechanical, byte-identical: every value is byte-identical in 8-bit sRGB after re-parsing the rounded oklch() output, with CIEDE2000 ΔE < 0.5. Files: - src/tokens/primitives/gray.ts (12) - src/tokens/primitives/accent.ts (13) - src/tokens/primitives/appearance.ts (96) - src/tokens/color.ts (24 overlays) - src/tokens/effects.ts (12 shadow rgba) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Replace the 'color' npm package (no OKLCH support) with culori across
the plugin's color parsing and serialization paths.
- colorToVSCodeColor: parses oklch()/hex/rgb/etc. via culori, returns
VS Code's {red,green,blue,alpha} sRGB shape, clamped to [0, 1]
- VSCodeColorToColor: emits oklch() strings on picker writes so user
edits stay consistent with the apsara design system convention
Bump plugin version 0.1.1 → 0.2.0 (picker writeback format change).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 WalkthroughWalkthroughThe VS Code extension undergoes a color system migration by replacing the 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 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 |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
packages/plugin-vscode/src/lib/utils.ts (1)
1-13: Add regression coverage for the new color pipeline.The parser/serializer swap looks coherent, but a few round-trip cases for
oklch(),transparent,currentColor, andinheritwould help lock down the new behavior.Also applies to: 55-101
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/plugin-vscode/src/lib/utils.ts` around lines 1 - 13, Add regression tests that exercise the parser/serializer round-trip for color inputs `oklch(...)`, `transparent`, `currentColor`, and `inherit` using the same pipeline referenced in the utils module: call parse and then serialize (the serializer used by the plugin) and assert the result is equivalent to the input; specifically exercise conversion paths that use toOklch and toRgb (converter('oklch') / converter('rgb')), and ensure rounding/clamping behavior via round and clamp01 does not break fidelity. Implement tests that feed representative oklch values (including edge cases like zero/chroma extremes), the literal keywords "transparent", "currentColor", and "inherit", and assert that parse -> serialize -> parse produces equivalent color semantics (and that tokens/TOKEN_PREFIX behavior is preserved). Ensure failures are captured as test assertions so regressions in the new color pipeline are caught.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@packages/plugin-vscode/src/lib/utils.ts`:
- Around line 1-13: Add regression tests that exercise the parser/serializer
round-trip for color inputs `oklch(...)`, `transparent`, `currentColor`, and
`inherit` using the same pipeline referenced in the utils module: call parse and
then serialize (the serializer used by the plugin) and assert the result is
equivalent to the input; specifically exercise conversion paths that use toOklch
and toRgb (converter('oklch') / converter('rgb')), and ensure rounding/clamping
behavior via round and clamp01 does not break fidelity. Implement tests that
feed representative oklch values (including edge cases like zero/chroma
extremes), the literal keywords "transparent", "currentColor", and "inherit",
and assert that parse -> serialize -> parse produces equivalent color semantics
(and that tokens/TOKEN_PREFIX behavior is preserved). Ensure failures are
captured as test assertions so regressions in the new color pipeline are caught.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: dc865b7f-53aa-4456-aaa7-221f911e9873
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (7)
packages/plugin-vscode/package.jsonpackages/plugin-vscode/src/lib/utils.tspackages/plugin-vscode/src/tokens/color.tspackages/plugin-vscode/src/tokens/effects.tspackages/plugin-vscode/src/tokens/primitives/accent.tspackages/plugin-vscode/src/tokens/primitives/appearance.tspackages/plugin-vscode/src/tokens/primitives/gray.ts
Summary
oklch()to match the apsara CSS migrationcolornpm package forculori(the old one can't parseoklch())Screen.Recording.2026-04-28.at.2.50.22.PM.mov