contrastRatio static method

double contrastRatio(
  1. double lighterL,
  2. double darkerL
)

Implementation

static double contrastRatio(double lighterL, double darkerL) {
  // https://www.w3.org/TR/WCAG20-TECHS/G18.html#G18-procedure
  final lighterY = Hsluv.lToY(lighterL);
  final darkerY = Hsluv.lToY(darkerL);
  return (lighterY + 0.05) / (darkerY + 0.05);
}