set-color-lightness

set-color-lightness(
	$color,
	$to
);

Description

This functions is similar to both color-lighten & color-darken except that instead it will always set the color to the exact value passed to the $to parameter.

Parameters

$color (color)
The color you want to target.

$to (percentage)
The lightness you wish to set the color to.
Example set-color-lightness(#000, 50%) will lighten the black and return a grey color of 50% lightness.
Default: 50%

Return

(CSS) $color set to specific lightness.

Examples

Ensure that the background color is set to exactly 60%

.foo {
  background-color: set-color-lightness($primaryColor, 60%);
}