', $custom_css ); $custom_css = preg_replace( '/\n/', '', $custom_css ); $custom_css = preg_replace( '/\t/', '', $custom_css ); return $custom_css; } /** * Returns color brightness. * * @param int Number of brightness. */ static function get_color_brightness( $hex_color ) { // Remove # string. $hex_color = str_replace( '#', '', $hex_color ); // Convert into RGB. $r = hexdec( substr( $hex_color, 0, 2 ) ); $g = hexdec( substr( $hex_color, 2, 2 ) ); $b = hexdec( substr( $hex_color, 4, 2 ) ); return ( ( ( $r * 299 ) + ( $g * 587 ) + ( $b * 114 ) ) / 1000 ); } /** * Check if the color is light. * * @param bool True if color is light. */ static function is_color_light( $hex_color ) { return ( self::get_color_brightness( $hex_color ) > 130 ); } /** * Check if the color is dark. * * @param bool True if color is dark. */ static function is_color_dark( $hex_color ) { return ( self::get_color_brightness( $hex_color ) <= 130 ); } } // Run Class. GT_Focus_Custom_Colors::setup();