mirror of
https://git.code.sf.net/p/seeddms/code
synced 2024-11-26 15:32:13 +00:00
new algo for contrast color based on lightness
This commit is contained in:
parent
198dc8c730
commit
39026ef4a8
|
@ -360,7 +360,12 @@ class SeedDMS_View_Common {
|
|||
$r = hexdec(substr($hexcolor, 1, 2));
|
||||
$g = hexdec(substr($hexcolor, 3, 2));
|
||||
$b = hexdec(substr($hexcolor, 5, 2));
|
||||
$yiq = (($r * 299) + ($g * 587) + ($b * 114)) / 1000;
|
||||
return ($yiq >= 148) ? '000000' : 'ffffff';
|
||||
if(0) {
|
||||
$yiq = (($r * 299) + ($g * 587) + ($b * 114)) / 1000;
|
||||
return ($yiq >= 148) ? '000000' : 'ffffff';
|
||||
} else {
|
||||
$l = (max($r, max($g, $b)) + min($r, min($g, $b)))/2;
|
||||
return ($l > 128) ? '000000' : 'ffffff';
|
||||
}
|
||||
} /* }}} */
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user