Color constructor
- int value
Construct an ColorSpace.sRGB color from the lower 32 bits of an int.
The bits are interpreted as follows:
- Bits 24-31 are the alpha value.
- Bits 16-23 are the red value.
- Bits 8-15 are the green value.
- Bits 0-7 are the blue value.
In other words, if AA is the alpha value in hex, RR the red value in hex,
GG the green value in hex, and BB the blue value in hex, a color can be
expressed as Color(0xAARRGGBB)
.
For example, to get a fully opaque orange, you would use const Color(0xFFFF9000)
(FF
for the alpha, FF
for the red, 90
for the
green, and 00
for the blue).
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(int value)
: this._fromARGBC(value >> 24, value >> 16, value >> 8, value, ColorSpace.sRGB);