Same name in other branches
- 8.x-2.x src/ColorBase.php \Drupal\color_field\ColorBase::patterns
Regexes to match various color formats.
Type: string[]
File
-
src/
ColorBase.php, line 17
Class
- ColorBase
- Base color class to ease implementations.
Namespace
Drupal\color_fieldCode
public static array $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})$/',
];