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(
  Color color, {
  Color darkColor = Colors.black,
  Color lightColor = Colors.white,
  double threshold = 0.183,
}) =>
    color.computeLuminance() > threshold ? darkColor : lightColor;