/** * The WCAG specification specifies two thresholds for AA and AAA compliance. * One specifies the threshold for large text, the other is for any sized * text. AA and AAA specify different thresholds. * * @param ColorContext $color * The color to analyze. * @param float $anySizeThreshold * The minimum threshold for luminosity for any text. * @param float $largeTextThreshold * The minimum threshold for luminosity for large text. * * @return string */ private function calculateWcagCompliance(ColorContext $color, $anySizeThreshold, $largeTextThreshold) { if ($color->diffLuminosity() >= $anySizeThreshold) { return 'Yes'; } elseif ($color->diffLuminosity() >= $largeTextThreshold) { return 'Large'; } return 'No'; }
public function columnValue(ColorContext $color) { return number_format(round($color->diffLuminosity(), $this->decimals), $this->decimals); }