tombenner / nui

Style iOS apps with a stylesheet, similar to CSS
MIT License
3.76k stars 460 forks source link

Support 'darken' and 'lighten' functions, like in LESS #49

Open benvium opened 11 years ago

benvium commented 11 years ago

LESS simplifies making highlight and shadow colors based on a primary colour by having a function that can darken or lighten an existing color. I think this'd be pretty cool as it'd save the designer having to darken a color in Photoshop and then type the new value in.

Here's an example of how this might look in the NSS file, based on the current demo.

@primaryBackgroundColor: #E6E6E6;
@primaryBackgroundTintColor: lighten(@primaryBackgroundColor, 30%);
@primaryBackgroundColorTop: lighten(@primaryBackgroundColor, 50%);
@primaryBackgroundColorTop: darken(@primaryBackgroundColor, 30%);

Note you should also be able to use these functions in any place where a color can be defined (background color, border color etc).

LESS also has saturate and desaturate functions that alert the colour saturation, which may also be useful. http://lesscss.org/#reference

This request is definitely a non-essential, nice-to-have feature!

tombenner commented 11 years ago

Agreed! This would be nice. Tangentially, I'd also like to consolidate the background-color-top/background-color-bottom combination into a single function, like background-color: gradient(red, yellow);.

It might make sense to wait until the new parser (#33) is implemented before doing these, though.