netbeast / colorsys

:art: Minimalistic color converter for RGB, HSV, HSL, CMYK, HEX and CSS strings
http://getyeti.co
MIT License
57 stars 16 forks source link

getColorEncoding function has an edge case that makes it falsy #28

Open safouman opened 3 years ago

safouman commented 3 years ago

Greetings,

in the getColorEncoding function:

if ((c.r + c.g + c.b) && typeof (c.r + c.g + c.b) === 'number')

in the above conditions and its similar in the code if r, g, b are zero rgb(0,0,0) , {r:0,g:0,b:0} the result will be falsy cause 0 && true equals false

would be great to verify the edge cases in each function