fix(studio): parse modern CSS colors without a new dependency - #3931
Draft
jrusso1020 wants to merge 1 commit into
Draft
fix(studio): parse modern CSS colors without a new dependency#3931jrusso1020 wants to merge 1 commit into
jrusso1020 wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.