basedOnLuminance method
Get a constrast color based on the luminance of this color. If
the luminance is bigger than 0.5, darkColor
is used, otherwise
lightColor
is used.
This is usually used to constrast text colors with the background.
Implementation
Color basedOnLuminance({
Color darkColor = Colors.black,
Color lightColor = Colors.white,
}) {
return computeLuminance() < 0.5 ? lightColor : darkColor;
}