public function isReadable(Color $backgroundColor, $level = 'AA', int $fontSize = 12): bool
    {
        $contrast = round($this->luminosityContrast($backgroundColor), 2);

        // Normal text
        if ($fontSize < 19) {
            return $contrast >= ($level === 'AA' ? 4.5 : 7.1);
        }

        return $contrast >= ($level === 'AA' ? 3.0 : 4.5);
    }
public function isReadable(Color $backgroundColor, $level = 'AA', int $fontSize = 12): bool
    {
        $contrast = round($this->luminosityContrast($backgroundColor), 2);

        // Normal text
        if ($fontSize < 19) {
            return $contrast >= ($level === 'AA' ? 4.5 : 7.1);
        }

        return $contrast >= ($level === 'AA' ? 3.0 : 4.5);
    }
public function isReadable ( Color $ backgroundColor , $ level = 'AA' , int $ fontSize = 12 ) : bool { $ contrast = round ( $ this -> luminosityContrast ( $ backgroundColor ) , 2 ) ; // Normal text if ( $ fontSize < 19 ) { return $ contrast >= ( $ level === 'AA' ? 4.5 : 7.1 ) ; } return $ contrast >= ( $ level === 'AA' ? 3.0 : 4.5 ) ; }
Checks to see if body text on a background color is readable based on WCAG2 standards

WCAG 2 level AA requires a contrast ratio of at least 4.5:1 for normal text and 3:1 for large text.
Level AAA requires a contrast ratio of at least 7:1 for normal text and 4.5:1 for large text.

Large text is defined as 14 point (typically 18.66px) and bold or larger, or 18 point (typically 24px) or larger.

@param Color  $backgroundColor
@param string $level
@param int    $fontSize

@return bool
Checks to see if body text on a background color is readable based on WCAG2 standards