cloudhead/less.js — pull request #730 by Synchro (2012-03-22 13:07:38+00:00)
Title: Add a contrast function

This is a second take on the previously rejected #488.

This adds a contrast function that given an existing colour, returns a contrasting colour value, either black/white, or other configurable light/dark values, and the threshold at which the colour choice is made is configurable too.
Cases where you might want to use this:

* ensuring text contrasts with a given background colour
* ensuring background contrasts with a given text colour
* ensuring borders contrast with background
* ensuring links contrast with normal text
* building gradients with sufficient colour range

A simple use example:

```css
.someblock {
background-color: @background;
color: contrast(@background);
}
```

I've re-implemented the function so the method signature and behaviour is the same as the [equivalent SASS function](http://compass-style.org/reference/compass/utilities/color/contrast/) and added the threshold parameter. This is a good partner to the colour processing functions in @matthewdl's #596.

There is currently no concise/DRY way of achieving this same result in LESS: mixin guards are way more verbose and require repeating every time they need to be applied.