wpseek.com
WordPress开发者和主题制作者的搜索引擎



rest_parse_hex_color › WordPress Function

Since5.4.0
已弃用n/a
rest_parse_hex_color ( $color )
参数:
  • (string) $color 3 or 6 digit hex color (with #).
    Required: Yes
返回:
  • (string|false)
定义在:
文档:

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



源码

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

	return $color;
}