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

Making Color API color spaces available in CSS #32

Open
LeaVerou opened this issue Feb 14, 2023 · 1 comment
Open

Making Color API color spaces available in CSS #32

LeaVerou opened this issue Feb 14, 2023 · 1 comment
Labels
api-design Issues related to API shape

Comments

@LeaVerou
Copy link
Collaborator

Perhaps we should have some kind of way to register a ColorSpace object and make it available to CSS.
I imagine it may need a worker of some sort, to separate its scope from JS APIs we don't want CSS colors to depend on,
and have some kind of registration function that is only exposed in that worker space.

In terms of namespace, I think it's fine if it's the same as colors generated through @color-profile (color(--colorspace ...coords)). E.g. we already have two ways to register custom properties (@property and CSS.registerProperty()), and that's fine. In fact, it could even be used to polyfill @color-profile!

Thoughts, @tabatkins ?

@LeaVerou LeaVerou added the api-design Issues related to API shape label Feb 14, 2023
@LeaVerou
Copy link
Collaborator Author

@tabatkins comment from #23 had an interesting idea: using @color-profile for the registration:

We do plan to allow them to be used together, but we're not yet sure how. That said, I'm almost certain it won't be by naively merging the namespaces. Instead, I suspect that either we'll come up with an alternate syntax for referring to a Color API space by name (which would serve the same purpose as the -- requirement in @color-profile, preventing collisions with built-ins); or we'll have some way to plumb a Color API space into @color-profile more directly, like an additional registration function, or perhaps a way to refer to a Color API space in @color-profile/src, either of which would mean they'd obey the -- requirement when you ref them in color().

@LeaVerou LeaVerou added this to the Level 2+ milestone Mar 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api-design Issues related to API shape
Projects
None yet
Development

No branches or pull requests

1 participant