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

Interpolation #2

Closed
LeaVerou opened this issue Apr 23, 2020 · 1 comment
Closed

Interpolation #2

LeaVerou opened this issue Apr 23, 2020 · 1 comment
Labels
enhancement New feature or request

Comments

@LeaVerou
Copy link
Member

LeaVerou commented Apr 23, 2020

API sketch:

  • color.steps(color2, {space, delta, steps, maxSteps})

  • Color.steps(color1, color2, {colorSpace, delta, steps, maxSteps})

  • If space is provided, it's used for the interpolation. If not, then a) if both colors have the same colorSpace, it's used for interpolation, otherwise Lab is used.

  • If delta is provided, the number of colors generated is such that the distance between any two consecutive ones does not exceed delta. maxSteps is used as a failsafe, to avoid getting way too many colors.

  • If steps are provided, the colors returned are at least that many (if delta is also provided they may need to be more)

@LeaVerou
Copy link
Member Author

LeaVerou commented Apr 30, 2020

Done, and updated the first post with the names and API I ended up going with.

If colorSpace is provided, it's used for the interpolation. If not, then a) if both colors have the same colorSpace, it's used for interpolation, otherwise Lab is used.

Not sure if this is actually a good idea. A lot of colors are sRGB, this means they'd be interpolated in sRGB, which is pretty shitty. We do this in CSS for backwards compat, but here perhaps we can just default to Lab?

LeaVerou pushed a commit that referenced this issue Oct 13, 2022
* Initial round of types review

* Address review
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant