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

Restrictions on the identifier of user-registered color spaces? #23

Open
danburzo opened this issue Aug 4, 2021 · 3 comments
Open

Restrictions on the identifier of user-registered color spaces? #23

danburzo opened this issue Aug 4, 2021 · 3 comments

Comments

@danburzo
Copy link

danburzo commented Aug 4, 2021

The CSS Color Level 4 mentions that the @color-profile at-rule works with <dashed-ident> to allow the registration of additional color spaces. The current spec mentions the ability to register color spaces. Will these color spaces need to be prefixed with --?

I'm in the process of implementing generic color serialization in the culori color library and was wondering whether a color space such as Jzazbz should be serialized to a CSS color value as color(jzazbz j a b) or color(--jzazbz j a b), such that the color space definition can be registered by the library consumer on their web pages.

@tabatkins
Copy link
Collaborator

No, Color API spaces don't need a -- prefix.

We don't currently have any way to bridge between @color-profile rules and Color API registered spaces; you can't use @color-profile spaces in Color API, and can't use Color API spaces in color().

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().

Sorry that, as far as I can tell, this doesn't help you out with your particular issue. ^_^

@danburzo
Copy link
Author

danburzo commented Aug 4, 2021

Thanks, @tabatkins, I appreciate the insight!

If I understand correctly, new ColorSpace("hsv") will make it into the <color> CSS type either as color(§hsv h s v / alpha) (with the § to be defined) or color(--hsv h s v / alpha) (with the plumbing between Color API and @color-profile to be defined).

The HSV example in the README also hints at the idea of a custom serialization (e.g. hsv(h s v / alpha)), which would require a parse counterpart to call on values found wherever the <color> CSS type is expected, but this kind of unrestrained color syntax sounds very complex.

@LeaVerou
Copy link
Collaborator

If I understand correctly, new ColorSpace("hsv") will make it into the <color> CSS type either as color(§hsv h s v / alpha) (with the § to be defined) or color(--hsv h s v / alpha) (with the plumbing between Color API and @color-profile to be defined).

No, these are programmatic modifications, at least for now. I'll open another issue about integrating the two.

The HSV example in the README also hints at the idea of a custom serialization (e.g. hsv(h s v / alpha)), which would require a parse counterpart to call on values found wherever the <color> CSS type is expected, but this kind of unrestrained color syntax sounds very complex.

Yeah, I'm not sure there are use cases for this, and I'm inclined to punt for L1.

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

3 participants