color_valid_hexadecimal_string

color_valid_hexadecimal_string($color)

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.

File

core/modules/color/color.module, line 350
Allows users to change the color scheme of themes.

Code

function color_valid_hexadecimal_string($color) {
  return preg_match('/^#([a-f0-9]{3}){1,2}$/iD', $color);
}
doc_Drupal
2016-10-29 08:50:09
Comments
Leave a Comment

Please login to continue.