Repository navigation
Color interpolation - #26
Conversation
mourner
left a comment
There was a problem hiding this comment.
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
interpolationproperty on functions that allowsusers to choose LAB or HCL color interpolation.