Dark on light
Polarity changes the signed APCA result.
#1e293b on #f8fafc+98.25 Lcnormal polarityKeep lightness contrast and text polarity visible when comparing a foreground with its background.
Dark on light
Polarity changes the signed APCA result.
#1e293b on #f8fafc+98.25 Lcnormal polarityLight on dark
Polarity changes the signed APCA result.
#f8fafc on #1e293b-100.79 Lcreverse polaritySwapping the same two colors changes more than the sign: this implementation returns 98.248081344886799 and -100.787598651287084.
ApcaContrast::lc() accepts the foreground first. A positive result represents dark text on a lighter background; a negative result represents the reverse polarity.
<?php
use PhpColor\Color\Color;
use PhpColor\Color\Contrast\ApcaContrast;
$text = Color::parse('#1e293b');
$surface = Color::parse('#f8fafc');
echo ApcaContrast::lc($text, $surface);
// 98.248081344886799
echo ApcaContrast::lc($surface, $text);
// -100.787598651287084
use PhpColor\Color\Color;
use PhpColor\Color\Contrast\ApcaContrast;
$text = Color::parse('#1e293b');
$surface = Color::parse('#f8fafc');
echo ApcaContrast::lc($text, $surface);
// 98.248081344886799
echo ApcaContrast::lc($surface, $text);
// -100.787598651287084
PHPColor returns the signed Lc value. It does not select the typography requirements for the finished interface or turn the measurement into a universal pass or fail verdict.