isDark property

bool get isDark

Checks if the Color is perceived as dark (luminance is below 0.5).

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

Example:

final needsWhiteText = Colors.black.isDark; // true

@returns True if the color's luminance is less than 0.5.

Implementation

bool get isDark => luminance < 0.5;