Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix off-by-one fromRGBO alpha value calculation (#13777)
Constructing colors using `fromRGBO` should return the same values as the CSS `rgba()` notation. rgba(0, 0, 255, 0.5) is the same as `#0000ff80` However `fromRGBO` sometimes creates a color with an off-by-one alpha value: expect(Color.fromRGBO(0, 0, 255, 0.5), Color(0x800000ff)); Expected: Color:<Color(0x800000ff)> Actual: Color:<Color(0x7f0000ff)> If we use `withOpacity` to create the same color, it returns the correct color: expect(Color.fromRGBO(0, 0, 255, 1).withOpacity(0.5), Color(0x800000ff)); This should also be changed in lib/web_ui/lib/src/ui/painting.dart in a followup change.
- Loading branch information