mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-02-11 09:35:00 +00:00
add method getContrastColor()
This commit is contained in:
parent
e21e301ea3
commit
9e6e13a041
|
@ -355,4 +355,12 @@ class SeedDMS_View_Common {
|
|||
}
|
||||
echo "};\n";
|
||||
} /* }}} */
|
||||
|
||||
public static function getContrastColor($hexcolor) { /* {{{ */
|
||||
$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';
|
||||
} /* }}} */
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user