get-theme-color
get-theme-color(
$shade,
$fallback
);
Description
This functions allows you to pass and string from a list of shades and return the associated color. This is particularly useful when creating a mixin that can use either a campaign shade or a color value.
Parameters
$shade
(shades | color)
The shade or color you want to get.
$fallback
(color)
The color to fallback to if the $shade
value cannot be found.
Default: null
Return
(color) Valid color.
Examples
Define mixin with theme parameter
@mixin foo-theme($theme: primary) {
$themeColor: get-theme-color($theme);
background: $themeColor;
/* ... */
}
.bar-shade {
@include foo-theme(secondary); /* outputs background: $secondaryColor */
}
.bar-color {
@include foo-theme(#3d3d3d); /* outputs background: #3d3d3d */
}
Updated about 4 years ago