Is it possible to create a mixin that sets text color based on the background? It seems straightforward with one color, but how about when there are two colors or changing the color of half of the text?
Try changing the text with a blue background..
https://i.sstatic.net/lYeWD.png
This is the simple mixin I have, but it doesn't seem to work as intended:
@mixin setColor($bg) {
@if (lightness($bg) > 50) {
color: $dark; // Lighter background, return dark color
} @else {
color: white; // Darker background, return light color
}
}