WP_Duotone::colord_parseprivate staticWP 6.3.0

Tries to convert an incoming string into RGBA values.

Direct port of colord's parse function simplified for our use case. This version only supports string parsing and only returns RGBA values.

Method of the class: WP_Duotone{}

No Hooks.

Returns

Array|null. An array of RGBA values or null if the string is invalid.

Usage

$result = WP_Duotone::colord_parse( $input );
$input(string) (required)
The string to parse.

Changelog

Since 6.3.0 Introduced.

WP_Duotone::colord_parse() code WP 7.0

private static function colord_parse( $input ) {
	$result = self::colord_parse_hex( $input );

	if ( ! $result ) {
		$result = self::colord_parse_rgba_string( $input );
	}

	if ( ! $result ) {
		$result = self::colord_parse_hsla_string( $input );
	}

	return $result;
}