-
Notifications
You must be signed in to change notification settings - Fork 6
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
Color interpolation #26
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great! My only concern is that conversion from RGB to LAB/HCL and back is relatively expensive and will happen on every function call, even though the stops will have the same values. Can we refactor the code in a way that caches the converted colors so that the work on an actual call is limited to simple interpolation?
Yep, I think that's very possible. We'd still have to convert back out to RGB, so it wouldn't be zero-cost. I'll work on a second iteration. |
55bdcb3 now translates colors on the way in and allows for an "outputFunction" that translates them on the way out. To do this we need to clone the parameters to avoid mutating it, so a JSON.parse/JSON.stringify loop. Do you think that's okay? |
Thanks for tackling this @tmcw! I like your syntax and implementation 👍 My 2¢: the word
vs
What do you think about using something like |
Yep, I agree. Changed |
@mourner are you ready to give this a ✅ ? |
1476a28
to
e341f80
Compare
Support a `colorSpace` property on functions that allows users to choose LAB or HCL color interpolation.
5add1c3
to
fc98374
Compare
Support an
interpolation
property on functions that allowsusers to choose LAB or HCL color interpolation.