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
@override
double computeLuminance() {
double linearize(double component) => component <= 0.03928
? component / 12.92
: math.pow((component + 0.055) / 1.055, 2.4).toDouble();
return 0.2126 * linearize(r) +
0.7152 * linearize(g) +
0.0722 * linearize(b);
}