Skip to content

fix(studio): parse modern CSS colors without a new dependency - #3931

Draft
jrusso1020 wants to merge 1 commit into
mainfrom
fix/studio-native-css-colors
Draft

fix(studio): parse modern CSS colors without a new dependency#3931
jrusso1020 wants to merge 1 commit into
mainfrom
fix/studio-native-css-colors

Conversation

@jrusso1020

Copy link
Copy Markdown
Collaborator

Studio’s color parser treats modern CSS colors and named gradient stops as unparseable, so the inspector can display black and gradient insertion can copy a neighboring stop instead of blending it.

Use the browser’s CSS parser to convert modern colors into sRGB through relative-color serialization, and share the parser with gradient interpolation. Extend the existing hex/RGB path to preserve alpha for short/long alpha hex and space-separated RGB. This is an alternative to #3752 with no new dependencies or lockfile changes. Modern-color conversion requires browser support for relative CSS colors; server-side parsing retains the hex/RGB path.

Validation: 27 focused Vitest tests pass using an isolated config (the normal Vite config requires built workspace packages). A real Chrome 146 regression script covers 18 color cases, computed-style picker conversion, alpha preservation, and two gradient cases. Studio typecheck, oxlint, oxfmt, and the fallow audit pass. Run the browser checks with bun run --cwd packages/studio test:colors:browser.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant