I've recently starting using LESS CSS - it's awesome (I recommend you check it out if you haven't yet).
I'm working on a project, where I would like to do the following (It's not proper syntax, it's only to try and explain my problem):
if(lightness(@background_color) <= 50%)
{
@secondary_color = #fff;
}
else
{
@secondary_color = #000;
}
I know that I can use mixins for this, but the above method would save me from having to write a mixins everytime I need to change a color based on the @background_color
variable (since I will be using @secondary_color
for borders, background colors, etc).
I've been trying to find a solution, but I've had no luck. If anybody has any idea's on what I can do to make this work, I'd love to hear them.
Thanks!
UPDATE I just reread your comment and understand the problem better. This should work:
Then use the mixin:
ADDED MORE COMPACT VERSION