EN
SASS - lighten color
0 points
In this article, we would like to show you how to lighten color in SASS.
Quick solution:
xxxxxxxxxx
1
lighten($color, $amount)
Where:
lighten()
- is a function that increases lightness of acolor
by a fixedamount
value,$color
- is a color variable or any color value - rgb / rgba / hex / color name / etc.,$amount
- is a percentage value by which the brightness of the color will increase, it must be a number between0%
and100%
.
In this example, we lighten the red
color by 30%
. The result is pink color.
xxxxxxxxxx
1
.element {
2
background: lighten(red, 30%);
3
}
rgb:
xxxxxxxxxx
1
.element {
2
background: lighten(rgb(255, 0, 0), 30%);
3
}
hex:
xxxxxxxxxx
1
.element {
2
background: lighten(#FF0000, 30%);
3
}
In this example, we present how to lighten variable in which color value is stored.
xxxxxxxxxx
1
$background-primary: red;
2
3
.element {
4
background: lighten($background-primary, 30%);
5
}