Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Serialization / Deserialization #6

Open
2 of 6 tasks
mattdesl opened this issue Aug 17, 2024 · 0 comments
Open
2 of 6 tasks

Serialization / Deserialization #6

mattdesl opened this issue Aug 17, 2024 · 0 comments

Comments

@mattdesl
Copy link
Member

mattdesl commented Aug 17, 2024

An issue to track this feature. Achieving full CSS parity is a complex task and will likely remain out of scope (and I imagine the CSS spec will continue to grow in complexity, with things like relative colors, color modifiers, and calculation).

However, it would be nice to have a serializer/deserializer that achieves the following:

  • Serializes to a CSS-like color string, which works for expected spaces (such as sRGB, OKLCH) but is not expected to work for non-supported spaces (e.g. Rec2020Linear)
  • Deserializes basic strings into a { id, coords } object
  • Evaluate whether there is a way to achieve keywords ("purple" etc) without increasing bundle size for all users
  • Perhaps some easy way to "parse" a string into a predictable color space – so that you don't have to do a manual lookup against the { id }
  • Somehow this should be achievable without creating additional file size bloat for users who don't need to deal with CSS color strings
  • Should be a way to handle arbitrary custom color spaces – for example if somebody creates CIELab color space, there should be a way for that to hook into serialize/deserialize functions

Although most of this is working already, the main thing is to figure out and perhaps refactor things to finish the last three tasks.

In addition to @texel/color, it would be nice to have @texel/css-color or something, that is able to parse and serialize strings with full CSS parity and keywords.

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

No branches or pull requests

1 participant