foregroundColor function
Gets the foreground color based on backgroundColor
Implementation
Color? foregroundColor(Color? backgroundColor) {
return backgroundColor == null || backgroundColor.alpha == 0
? null
: backgroundColor.computeLuminance() >= 0.5
? Colors.black
: Colors.white;
}