Determines if a hexadecimal CSS color string is valid.
$color: The string to check.
TRUE if the string is a valid hexadecimal CSS color string, or FALSE if it isn't.
function color_valid_hexadecimal_string($color) {
return preg_match('/^#([a-f0-9]{3}){1,2}$/iD', $color);
}