calculateTextColor function

Color calculateTextColor(
  1. Color background
)

A method used for getting color for the given background brightness. If the background color is considered bright it will return Colors.black, otherwise it will return Colors.white.

Implementation

Color calculateTextColor(Color background) =>
    background.computeLuminance() >= 0.5 ? Colors.black : Colors.white;