`rgbToColorString` produces wrong color when `alpha` is `0`
sgoll opened this issue · 1 comments
sgoll commented
polished
version: 3.6.3
Mixin/Helper/Shorthand Usage
rgbToColorString({ red: 255, green: 205, blue: 100, alpha: 0.0 })
What You Are Seeing
The (wrong) result is #ffcd64
.
What You Expected To See
The expected result is rgba(255,205,100,0)
.
Reproduction
https://codesandbox.io/s/patient-lake-tdqty
Analysis
The problem is this comparison:
polished/src/color/rgbToColorString.js
Line 39 in faac33f
The evaluation of color.alpha
is probably not necessary at all. Any not-null (null
/undefined
) checks are included in typeof color.alpha === 'number'
already.