mixins.less 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. @gradient: 'false';
  2. .gradientBar(@primaryColor, @secondaryColor, @textColor: #fff, @textShadow: 0 -1px 0 rgba(0,0,0,.25)) {
  3. color: @textColor;
  4. text-shadow: @textShadow;
  5. .gradient(@primaryColor, @secondaryColor, @gradient);
  6. border-color: @primaryColor;
  7. }
  8. // Gradients
  9. .gradient(@startColor: #555, @endColor: #333, @gradient) when not (@gradient) {
  10. background-color: @startColor;
  11. }
  12. .gradient(@startColor: #555, @endColor: #333, @gradient) when (@gradient) {
  13. background-color: mix(@startColor, @endColor, 60%);
  14. background-image: -moz-linear-gradient(top, @startColor, @endColor);
  15. background-image: -webkit-gradient(linear, 0 0, 0 100%, from(@startColor), to(@endColor));
  16. background-image: -webkit-linear-gradient(top, @startColor, @endColor);
  17. background-image: -o-linear-gradient(top, @startColor, @endColor);
  18. background-image: linear-gradient(to bottom, @startColor, @endColor);
  19. background-repeat: repeat-x;
  20. filter: e(%("progid:DXImageTransform.Microsoft.gradient(startColorstr='%d', endColorstr='%d', GradientType=0)",argb(@startColor),argb(@endColor)));
  21. }
  22. // Button Background
  23. .buttonBackground(@startColor, @endColor, @textColor: #fff, @textShadow: 0 -1px 0 rgba(0,0,0,.25)) when not (@gradient) {
  24. .gradientBar(@startColor, @endColor, @textColor, @textShadow);
  25. &:hover {
  26. border-color: lighten(@startColor, 5%) !important;
  27. background-color: lighten(@startColor, 5%);
  28. }
  29. &:active, &:focus {
  30. border-color: darken(@startColor, 5%) !important;
  31. background-color: darken(@startColor, 5%);
  32. }
  33. &[disabled] {
  34. border-color: lighten(@startColor, 20%) !important;
  35. background-color: lighten(@startColor, 20%);
  36. }
  37. }
  38. .buttonBackground(@startColor, @endColor, @textColor: #fff, @textShadow: 0 -1px 0 rgba(0,0,0,.25)) when (@gradient) {
  39. .gradientBar(@startColor, @endColor, @textColor, @textShadow);
  40. border-color: transparent !important;
  41. &:hover {
  42. .gradientBar(lighten(@startColor, 5%), lighten(@endColor, 5%), lighten(@textColor, 5%), @textShadow);
  43. }
  44. &:active, &:focus {
  45. .gradientBar(darken(@startColor, 5%), darken(@endColor, 5%), darken(@textColor, 5%), @textShadow);
  46. }
  47. &[disabled] {
  48. .gradientBar(lighten(@startColor, 20%), lighten(@endColor, 20%), lighten(@textColor, 20%), @textShadow) !important;
  49. }
  50. }