isLight property

bool get isLight

Checks if the Color is perceived as light (luminance is 0.5 or above).

Useful for determining if dark text should be used over the background.

Example:

final needsDarkText = Colors.yellow.isLight; // true

@returns True if the color's luminance is 0.5 or greater.

Implementation

bool get isLight => luminance >= 0.5;