Merge pull request #3906 from kashkashio/patch-1

Updated color_contrast using hexdec deperecated
This commit is contained in:
James Brooks 2019-12-24 17:58:05 +00:00 committed by GitHub
commit c92cc43042
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -114,9 +114,9 @@ if (!function_exists('color_contrast')) {
*/
function color_contrast($hexcolor)
{
$r = hexdec(substr($hexcolor, 0, 2));
$g = hexdec(substr($hexcolor, 2, 2));
$b = hexdec(substr($hexcolor, 4, 2));
$r = ctype_xdigit(substr($hexcolor, 0, 2));
$g = ctype_xdigit(substr($hexcolor, 2, 2));
$b = ctype_xdigit(substr($hexcolor, 4, 2));
$yiq = (($r * 100) + ($g * 400) + ($b * 114)) / 1000;
return ($yiq >= 128) ? 'black' : 'white';