wpseek.com
Eine auf WordPress spezialiserte Suchmaschine für Entwickler und Theme-Autoren



rest_parse_hex_color › WordPress Function

Seit5.4.0
Veraltetn/v
rest_parse_hex_color ( $color )
Parameter:
  • (string) $color 3 or 6 digit hex color (with #).
    Erforderlich: Ja
Gibt zurück:
  • (string|false)
Definiert in:
Codex:

Parses a 3 or 6 digit hex color (with #).



Quellcode

function rest_parse_hex_color( $color ) {
	$regex = '|^#([A-Fa-f0-9]{3}){1,2}$|';
	if ( ! preg_match( $regex, $color, $matches ) ) {
		return false;
	}

	return $color;
}