Color.fromRGBO constructor
Create an sRGB color from red, green, blue, and opacity, similar to
rgba()
in CSS.
r
is red, from 0 to 255.g
is green, from 0 to 255.b
is blue, from 0 to 255.opacity
is alpha channel of this color as a double, with 0.0 being transparent and 1.0 being fully opaque.
Out of range values are brought into range using modulo 255.
See also fromARGB, which takes the opacity as an integer value.
Note
Each color is stored as floating-point color components, where the final
value of each component is approximated by storing c / 255
, where c
is one of the four components (alpha, red, green, blue).
Implementation
const Color.fromRGBO(int r, int g, int b, double opacity)
: this._fromRGBOC(r, g, b, opacity, ColorSpace.sRGB);