Gradient.js icon indicating copy to clipboard operation
Gradient.js copied to clipboard

The gradient should use the shortest way

Open eskimoblood opened this issue 11 years ago • 2 comments

If the diff between 2 hues is greater then 180 it should use the other direction. bildschirmfoto 2014-10-02 um 17 03 16

In the above example you can see that it goes around the whole color wheel to go from light red to red instead of using the other direction.

eskimoblood avatar Oct 03 '14 14:10 eskimoblood

What are the input arguments you used to get that output?

I haven't touched this code in quite a while, but off the top of my head the last argument is the # of steps to take. What if the sign of that value indicated direction? E.g. Gradient('blue', 'red', 10) would go one direction and Gradient('blue', 'red', -10) would go the other direction?

tstone avatar Oct 04 '14 04:10 tstone

The problem comes when you have more then two colors as you can see in this example. The colors are:

"#3FB8AF", "#7FC7AF", "#DAD8A7", "#FF9E9D", "#FF3D7F"

eskimoblood avatar Oct 04 '14 06:10 eskimoblood