Currently I'm using
color: hsl(hue(@black), saturation(@black), 100 - lightness(@black));
to invert colors but
color: invert(@color)
would be much better syntax for the job.
The code for function:
invert: function (color) { var rgb = [255 - color.rgb[0], 255 - color.rgb[1], 255 - color.rgb[2]]; return new(tree.Color)(rgb); },
I tested it with less.js 1.2.1 so it works
Updated original post
+1 for this:
Just to clarify, do you mean that you are using
hsl(hue(@color), saturation(@color), 100 - lightness(@color));
+1 as well.
this can now be achieved with negation
http://lesscss.org/functions/#color-blending-negation
Not really the negation
. The javascript code posted by @Oskariok is simple Less (#fff - @color)
or equal difference(#fff, @color)
. However the Less code suggested by @ascottmccauley later is not the same, it only inverts colour lightness (so Less and javascript snippets of the first post do not match each other). "Invert lightness" can also be achieved with less verbose: spin((#fff - @color), 180);
okay well either way..
Most helpful comment
+1 for this:
Just to clarify, do you mean that you are using