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

Exposing predefined ColorSpace objects as static properties on ColorSpace? #33

Open
LeaVerou opened this issue Feb 14, 2023 · 4 comments
Labels
api-design Issues related to API shape

Comments

@LeaVerou
Copy link
Collaborator

@tabatkins suggested we should the predefined color spaces as static properties on ColorSpace. We may instead want to expose them on a sub-object, to avoid polluting ColorSpace as a namespace.

Btw the spec should also include an appendix with example code for the predefined (Color 4) color spaces.

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

I don't understand "polluting the namespace". Do we really think we're likely to have predefined colorspaces with names that clash with methods/attributes we want on ColorSpace? That seems pretty unlikely, from the current set.

@LeaVerou
Copy link
Collaborator Author

It's unlikely, but can you guarantee there will never be such a conflict?
Also, it's unclear what something like ColorSpace.foo means.

I don't have a strong opinion, just some second thoughts.

@tabatkins
Copy link
Collaborator

It's unlikely, but can you guarantee there will never be such a conflict?

Of course not, but we don't deal in absolutes, and we can just tweak names as necessary. But I find it exceedingly unlikely that a predefined colorspace (with the names coming from industry, generally) will overlap with the sort of method and attribute names we'll be using here.

Also, it's unclear what something like ColorSpace.foo means.

I think it's pretty clear that ColorSpace.a98RGB means "the a98-rgb color space". I literally can't come up with a clearer, more straightforward way to express that.

@LeaVerou
Copy link
Collaborator Author

I think after reading the responses in w3ctag/design-reviews#817 I’m leaning towards that we shouldn't do this in L1.

@LeaVerou LeaVerou changed the title Exposing predefined ColorSpace objects Exposing predefined ColorSpace objects? Feb 16, 2023
@LeaVerou LeaVerou changed the title Exposing predefined ColorSpace objects? Exposing predefined ColorSpace objects as static properties on ColorSpace? Feb 16, 2023
@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

2 participants