src/ContrastAlgorithm/LuminosityContrast.php
public function calculate(ColorJizz $foreground, ColorJizz $background)
    {
        $fgLuma  = $this->relativeLuminosity($foreground->toRGB());
        $bgLuma  = $this->relativeLuminosity($background->toRGB());

        if ($fgLuma > $bgLuma) {
            return ($fgLuma + 0.05) / ($bgLuma + 0.05);
        } else {
            return ($bgLuma + 0.05) / ($fgLuma + 0.05);
        }
    }
public function calculate(ColorJizz $foreground, ColorJizz $background)
    {
        $fgLuma  = $this->relativeLuminosity($foreground->toRGB());
        $bgLuma  = $this->relativeLuminosity($background->toRGB());

        if ($fgLuma > $bgLuma) {
            return ($fgLuma + 0.05) / ($bgLuma + 0.05);
        } else {
            return ($bgLuma + 0.05) / ($fgLuma + 0.05);
        }
    }
public function calculate ( ColorJizz $ foreground , ColorJizz $ background ) { $ fgLuma = $ this -> relativeLuminosity ( $ foreground -> toRGB ( ) ) ; $ bgLuma = $ this -> relativeLuminosity ( $ background -> toRGB ( ) ) ; if ( $ fgLuma > $ bgLuma ) { return ( $ fgLuma + 0.05 ) / ( $ bgLuma + 0.05 ) ; } else { return ( $ bgLuma + 0.05 ) / ( $ fgLuma + 0.05 ) ; } }
returns the contrast ratio between foreground and background color.

@param ColorJizz $foreground
@param ColorJizz $background

@return float
returns the contrast ratio between foreground and background color .