Closed ooesili closed 6 years ago
Closing this as a duplicate of #21 and mentioned in the readme's FAQ.
I'm not sure setting everything to zero is the right call, since an undefined operation is asked (invert multiplication by zero; in your example, the code needs to figure out "what is x
, and that is undefined).
Though I agree panic
ing is not good either.
We could turn this into an error and let the user handle it, or give MakeColor
an extra parameter with the value that should be used as the default in this case. Are you up to making a PR with one of those options?
If I call
colorful.MakeColor
on acolor.Color
with zero in the alpha channel, this happens:The following code can be used to reproduce the issue:
I don't know really know what to expect in the return value (I'm not really much of color expert), but I'd assume it should return zero values for everything, since if every value in a
color.Color
is expected to be alpha-multiplied, andx * 0 == 0
.