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

New API to normalize color values without NaN. #479

Open
facelessuser opened this issue Mar 11, 2024 · 1 comment
Open

New API to normalize color values without NaN. #479

facelessuser opened this issue Mar 11, 2024 · 1 comment

Comments

@facelessuser
Copy link
Collaborator

#476 (comment)

@LeaVerou
Copy link
Member

LeaVerou commented Mar 11, 2024

My comment was:

Not a blocker, but I think we need something higher level than this, i.e. a function to drop nones either by converting to 0 or taking coords from another color. If that function does not mutate objects but returns new ones, it will also fix the serialization problem. Can you open a new issue for the API design discussion?

I’m envisioning a function that would take a single color as its first argument, and optionally a variable number of other colors which would be used to resolve none values (anything after the first such color would only be used in case the first one also has none values. If no other color is provided, none is just converted to 0.

  • Would such a design work?
  • What should the function be called?
  • Should it mutate the color or return a new color?

We could also then add a allowNone: true | false (or dropNone depending on what we want the default to be) option to serialize() as a shortcut to this.

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

2 participants