textColorByLuminance static method

Color textColorByLuminance(
  1. Color color, {
  2. Color darkColor = Colors.black,
  3. Color lightColor = Colors.white,
  4. double threshold = 0.183,
})

Implementation

static Color textColorByLuminance(
  final Color color, {
  final Color darkColor = Colors.black,
  final Color lightColor = Colors.white,
  final double threshold = 0.183,
}) => color.computeLuminance() > threshold ? darkColor : lightColor;