function designkit_valid_color in DesignKit 7
Same name and namespace in other branches
- 6 designkit.module \designkit_valid_color()
Determine whether a given color string is valid. Must be in the form of #ffffff (6 digit hex with preceding #) or #fff (3 digit hex with preceding #).
4 calls to designkit_valid_color()
- designkit_colorhsl in ./
designkit.module - Retrieve the HSL of a color, or the specified component.
- designkit_colorshift in ./
designkit.module - Apply a shift color to a source color by a certain opacity value.
- designkit_validate_color in ./
designkit.admin.inc - Element validate callback for color setting.
- _designkit_form_alter in ./
designkit.admin.inc - Implementation of hook_form_alter() for spaces_features_form, system_theme_settings.
1 string reference to 'designkit_valid_color'
- _designkit_preprocess in ./
designkit.module - Helper function to turn design choices into theme variables.
File
- ./
designkit.module, line 124
Code
function designkit_valid_color($color) {
$matches = array();
preg_match('/(#[0-9a-f]{6}|#[0-9a-f]{3})/i', $color, $matches);
if ($matches && (strlen($color) === 7 || strlen($color) === 3)) {
return TRUE;
}
return FALSE;
}