foregroundColor function

Color? foregroundColor(
  1. Color? backgroundColor
)

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;
}