What is scale-color() function good for in Sass?
Experience Level:
Junior
Tags:
Sass
Answer
The scale-color() function allows to fluidly scale different color properties.
The following color properties can be modified:
- $red - color red channel
- $green - color green channel
- $blue - color blue channel
- $saturation - color saturation
- $lightness - color lightness
- $alpha - color alpha channel
$color: red;
.color1 {
background: scale-color($color, $red: 10%);
}
.color2 {
background: scale-color($color, $lightness: -30%);
}
CSS
.color1 {
background: red;
}
.color2 {
background: #b30000;
}
Related Sass job interview questions
-
What are partials in Sass?
Sass Junior -
What is a difference between Sass and CSS?
Sass Junior -
What are lighten() and darken() functions good for in Sass?
Sass Junior -
What is Interpolation in Sass and when would you use it?
Sass Junior -
In Sass, can you declare two different variables that have the same name and different scope? Describe what happens in such situation.
Sass Junior