When assigning "rgba(255, 0, 0, 0.5)" to ctx.fillStyle (ctx is a context of a canvas here) on Chrome for PC, the value is automatically changed to "rgba(255, 0, 0, 0.501960784313726)", where the other browsers (Firefox, Safari, Chrome) are "rgba(255, 0, 0, 0.5)".
Please see a PoC below for details.
I think the alpha value 0.501960784313726 is basically came from 128 / 255, however, the detail is unknown. (It may be related to some decimal rounding problem, because the changed value takes discrete values when we give 0.005883 and 0.05882999999999)
Environments:
- Windows:
- Chrome 98.0.4758.102 -> incorrect value
- Firefox 97.0.1 -> correct value
- Edge 98.0.1108.56 -> incorrect value
- Mac:
- Chrome 98.0.4758.102 -> incorrect value
- Firefox 96.0.3
-> correct value
- Safari 17612.3.6.1.6
-> correct value
- Android:
- Chrome 98.0.4758.101 -> incorrect value
- iOS:
- Chrome 98.0.4758.97 -> correct value
PoC result images:
0.00582999999999 vs. 0.00583:
thanks!