Skip to content

Instantly share code, notes, and snippets.

@colin-haber
Created March 25, 2012 01:00
Show Gist options
  • Save colin-haber/2190496 to your computer and use it in GitHub Desktop.
Save colin-haber/2190496 to your computer and use it in GitHub Desktop.
.background-color-shift (@color, @amount: 10%) when (lightness(@color) > 50%) {
background-color: darken(@color, @amount);
}
.background-color-shift (@color, @amount: 10%) when (lightness(@color) <= 50%) {
background-color: lighten(@color, @amount);
}
.text-color-shift (@color, @amount: 10%) when (lightness(@color) > 50%) {
color: darken(@color, @amount);
}
.text-color-shift (@color, @amount: 10%) when (lightness(@color) <= 50%) {
color: lighten(@color, @amount);
}
@fat
Copy link

fat commented Mar 25, 2012

replace <= with =<.

In less the comparisons match on this: /^(?:>=|=<|[<=>])/

@colin-haber
Copy link
Author

Thanks, @fat. I forgot LESS comparisons worked that way.

@fat
Copy link

fat commented Mar 27, 2012

No worries :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment