I want to create a function which will change color based on background-colorlightness(), but get an error
Argument $color of lightness($color) must be a color
When I setup color: set-color(#000000); everything is okay, but I need to setup varibable ($background-color). Is there is a way to achieve it?
@function set-color($color) {
@if (lightness($color) >= 50) {
@return #000;
}
@else {
@return #FFF;
}
}
$background-color: attr(data-color);
background-color: $background-color;
color: set-color($background-color);