function color_valid_hexadecimal_string

color_valid_hexadecimal_string($color)

Determines if a hexadecimal CSS color string is valid.

Parameters

$color: The string to check.

Return value

TRUE if the string is a valid hexadecimal CSS color string, or FALSE if it isn't.

File

modules/color/color.module, line 340
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);
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/modules!color!color.module/function/color_valid_hexadecimal_string/7.x