less.js
less.js copied to clipboard
Create function with return value
Hello!
I need to do something like this:
.GetColorByLightness (@color) when (lightness(@color) < 50%) { return #FFFFFF; } .GetColorByLightness (@color) when (lightness(@color) >= 50%) { return #000000; }
body{ color: .GetColorByLightness(#CCC); }
So I need to create a function that I can use to return a value and not an attibute and its value.
Thanks, Mariana Silva
I've just proposed similar functionality in issue 637.
going to move discussion over custom functions over to #637 - more comments there.