function color_valid_hexadecimal_string
Same name in other branches
- 7.x modules/color/color.module \color_valid_hexadecimal_string()
- 8.9.x core/modules/color/color.module \color_valid_hexadecimal_string()
Determines if a hexadecimal CSS color string is valid.
Parameters
string $color: The string to check.
Return value
bool TRUE if the string is a valid hexadecimal CSS color string, or FALSE if it isn't.
2 calls to color_valid_hexadecimal_string()
- color_palette_color_value in core/
modules/ color/ color.module - Determines the value for a palette color field.
- color_scheme_form_validate in core/
modules/ color/ color.module - Form validation handler for color_scheme_form().
File
-
core/
modules/ color/ color.module, line 342
Code
function color_valid_hexadecimal_string($color) {
return (bool) preg_match('/^#([a-f0-9]{3}){1,2}$/iD', $color);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.