Styles: Functions
Functions used in the SS&C CSS to manage complexity and provide a consistentexperience.
There are currently two custom functions in the SS&C CSS to help manage colors and manipulate the names. These functions must be included early in your SASS for many of the mixins and styles to work correctly.
Function: color($key)
This function overrides and extends the base Bootstrap color system. It allows for the use of custom color names in the CSS, and provides a fallback to the primary color if the color is not found.
1@function color($key) {
2 $key: str-replace($key, "--");
3 @if map-has-key($colors, $key) {
4 @return map-get($colors, $key);
5 }
6 @else {
7 @return theme-color("primary");
8 }
9}Function: str-replace($string, $search, $replace: "")
This function is a simple string replacement function for use in your SASS. It
used in the above color function to remove the -- from the color name.
1@function str-replace($string, $search, $replace: "") {
2 $index: str-index($string, $search);
3 @if $index {
4 @return str-slice($string, 1, $index - 1) + $replace +
5 str-replace(
6 str-slice($string, $index + str-length($search)),
7 $search,
8 $replace
9 );
10 }
11 @return $string;
12}