Gerillass
v2.1.0Type: Function
isColor();
Returns the value if every item in it is a colour, and errors otherwise.
Arguments
| Name | Type | Description |
|---|---|---|
$value | color | list | Accepts a colour, or a list of colours. |
Examples
Validating a colour argument in a mixin of your own.
@mixin badge($color) {
background-color: isColor($color);
color: white;
}
.badge {
@include badge(crimson);
}.badge {
background-color: crimson;
color: white;
}What it refuses
Arguments are checked, so a wrong value stops the build with a message instead of quietly producing the wrong CSS.
$brand: crimson;
.badge {
background-color: isColor(brand);
}Error: 'brand' is not a color value, please replace it with a valid one.