calculateContrast static method

dynamic calculateContrast({
  1. required Color contrastColor,
  2. required Color color,
})

Implementation

static calculateContrast(
    {required Color contrastColor, required Color color}) {
  var lum1 = UpThemes()
      ._luminance(contrastColor.red, contrastColor.green, contrastColor.blue);
  var lum2 = UpThemes()._luminance(color.red, color.green, color.blue);

  var brightest = max<num>(lum1, lum2);
  var darkest = min<num>(lum1, lum2);
  return (brightest + 0.05) / (darkest + 0.05);
}