'; } return; } return; // The background will be compile into the theme's global css file } /** * Detect if we should use a light or dark colour on a background colour. * * @param mixed $color * @param string $dark (default: '#000000') * @param string $light (default: '#FFFFFF') * * @return string */ function analytica_light_or_dark( $color, $dark = '#000000', $light = '#FFFFFF' ) { $hex = str_replace( '#', '', $color ); $c_r = hexdec( substr( $hex, 0, 2 ) ); $c_g = hexdec( substr( $hex, 2, 2 ) ); $c_b = hexdec( substr( $hex, 4, 2 ) ); $brightness = (($c_r * 299) + ($c_g * 587) + ($c_b * 114) ) / 1000; return $brightness > 155 ? $dark : $light; }