paintbag gradients division by zero
In the paintbag library the methods that create a gradient can throw an division by zero error.
That happens if n < 2
, meaning that the number of colors returned has to be shorter than the minimum of expected colors (2).
The methods should not throw an error.
Possible alternatives if n==1
are:
- return []
- return c1
- return c2
- return (c1+c2)/2
and if n<=0
:
- return []