getLuminance method

double getLuminance()

Returns the luminance of the color.

Luminance is calculated using a specific formula that takes into account the perceived brightness of the red, green, and blue components. It provides a better representation of how bright a color is compared to brightness, which is more linear.

Example:

Color color = Color(0xFF42A5F5);
double luminance = color.getLuminance();
print(luminance); // Output: 0.309 (indicating how bright the color is)

Implementation

double getLuminance() => computeLuminance();