// set text color based on bg
@function set-text-color($color) {
@if (lightness($color) > 70) {
@return #333;
} @else {
@return #fff;
}
}
// set bg color & text color
@mixin set-background($color) {
background-color: $color;
color: set-text-color($color);
}
Use the mixin - "set-background"h1 {
@include set-background($primary-color);
}
Changing bg-color effect on text-color: https://youtu.be/nu5mdN2JIwM?t=2333