Automattic\WooCommerce\Blocks\BlockTypes
CouponCode::is_css_color_value
Check if a string is a valid CSS color value (hex, rgb, or hsl).
Method of the class: CouponCode{}
No Hooks.
Returns
true|false.
Usage
// private - for code of main (parent) class only $result = $this->is_css_color_value( $value ): bool;
- $value(string) (required)
- Value to check.
CouponCode::is_css_color_value() CouponCode::is css color value code WC 10.8.1
private function is_css_color_value( string $value ): bool {
return str_starts_with( $value, '#' )
|| str_starts_with( $value, 'rgb' )
|| str_starts_with( $value, 'hsl' );
}