public static property ColorBase::$patterns in Color Field 8.2
Regexes to match various color formats.
Type: array
File
- src/
ColorBase.php, line 39
Class
- ColorBase
- Base color class to ease implementations.
Namespace
Drupal\color_fieldCode
public static $patterns = [
'cmyk' => '/^(?:device-)?cmyk\\((\\d{1,3}),\\s*(\\d{1,3}),\\s*(\\d{1,3}),\\s*(\\d+(?:\\.\\d+)?|\\.\\d+)\\s*\\)/',
'rgba' => '/^rgba\\((\\d{1,3}),\\s*(\\d{1,3}),\\s*(\\d{1,3}),\\s*(\\d+(?:\\.\\d+)?|\\.\\d+)\\s*\\)/',
'rgb' => '/^rgb\\((\\d{1,3}),\\s*(\\d{1,3}),\\s*(\\d{1,3})\\)$/',
'hsla' => '/^hsla\\((\\d{1,3}),\\s*(\\d{1,3})%,\\s*(\\d{1,3})%,\\s*(\\d+(?:\\.\\d+)?|\\.\\d+)\\s*\\)/',
'hsl' => '/^hsl\\((\\d{1,3}),\\s*(\\d{1,3})%,\\s*(\\d{1,3})%\\)$/',
'hsva' => '/^hsva\\((\\d{1,3}),\\s*(\\d{1,3})%,\\s*(\\d{1,3})%,\\s*(\\d+(?:\\.\\d+)?|\\.\\d+)\\s*\\)$/',
'hsv' => '/^hsv\\((\\d{1,3}),\\s*(\\d{1,3})%,\\s*(\\d{1,3})%\\)$/',
'hex6' => '/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/',
'hex3' => '/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/',
];