computeLuminance method
Returns a brightness value between 0 for darkest and 1 for lightest.
Represents the relative luminance of the color. This value is computationally expensive to calculate.
Implementation
double computeLuminance() {
// See <https://www.w3.org/TR/WCAG20/#relativeluminancedef>
final R = _linearizeColorComponent(red / 0xFF);
final G = _linearizeColorComponent(green / 0xFF);
final B = _linearizeColorComponent(blue / 0xFF);
return 0.2126 * R + 0.7152 * G + 0.0722 * B;
}