_background-gradient.scss 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. /**
  2. * Creates a background gradient.
  3. *
  4. * @param {Color} $bg-color The background color of the gradient
  5. * @param {String/List} [$type] The type of gradient to be used. Can either
  6. * be a String which is a predefined gradient, or it can can be a list of
  7. * color_stops. If none is set, it will still set the `background-color`
  8. * to the $background-color.
  9. * @param {String} [$direction=top] The direction of the gradient. Can either be
  10. * `top` or `left`.
  11. * @member Global_CSS
  12. */
  13. @mixin background-gradient($bg-color, $type: $base-gradient, $direction: top) {
  14. background-image: none;
  15. background-color: $bg-color;
  16. @if $base-gradient != null and $bg-color != transparent {
  17. //color_stops
  18. @if type-of($type) == "list" {
  19. @include background-image(linear-gradient($direction, $type));
  20. }
  21. //default gradients
  22. @else if $type == bevel {
  23. @include background-image(linear-gradient($direction, color_stops(
  24. lighten($bg-color, 15%),
  25. lighten($bg-color, 8%) 30%,
  26. $bg-color 65%,
  27. darken($bg-color, 6%)
  28. )));
  29. } @else if $type == glossy {
  30. @include background-image(linear-gradient($direction, color_stops(lighten($bg-color, 15%), lighten($bg-color, 5%) 50%, $bg-color 51%, darken($bg-color, 5%))));
  31. } @else if $type == recessed {
  32. @include background-image(linear-gradient($direction, color_stops(darken($bg-color, 10%), darken($bg-color, 5%) 10%, $bg-color 65%, lighten($bg-color, .5%))));
  33. } @else if $type == matte {
  34. @include background-image(linear-gradient($direction, color_stops(lighten($bg-color, 3%), darken($bg-color, 4%))));
  35. } @else if $type == matte-reverse {
  36. @include background-image(linear-gradient($direction, color_stops(darken($bg-color, 6%), lighten($bg-color, 4%))));
  37. } @else if $type == glossy-toolbar {
  38. @include background-image(linear-gradient($direction, color_stops(#F0F5FA, #DAE6F4 2%, #CEDDEF)));
  39. }
  40. //ext3.3 gradients
  41. @else if $type == panel-header {
  42. @include background-image(linear-gradient($direction, color_stops(
  43. adjust-color($bg-color, $hue: -0.857deg, $saturation: -1.63%, $lightness: 3.529%),
  44. adjust-color($bg-color, $hue: 0.158deg, $saturation: -1.21%, $lightness: 0.392%) 45%,
  45. adjust-color($bg-color, $hue: 1.154deg, $saturation: 0.607%, $lightness: -7.647%) 46%,
  46. adjust-color($bg-color, $hue: 1.154deg, $saturation: 0.607%, $lightness: -7.647%) 50%,
  47. adjust-color($bg-color, $hue: 1.444deg, $saturation: -1.136%, $lightness: -4.706%) 51%,
  48. $bg-color
  49. )));
  50. } @else if $type == tabbar {
  51. @include background-image(linear-gradient($direction, color_stops(
  52. adjust-color($bg-color, $hue: 0.0deg, $saturation: 1.604%, $lightness: 4.706%),
  53. $bg-color
  54. )));
  55. } @else if $type == tab {
  56. @include background-image(linear-gradient($direction, color_stops(
  57. adjust-color($bg-color, $hue: 1.382deg, $saturation: -18.571%, $lightness: -4.902%),
  58. adjust-color($bg-color, $hue: 0.43deg, $saturation: -10.311%, $lightness: -2.157%) 25%,
  59. $bg-color 45%
  60. )));
  61. } @else if $type == tab-active {
  62. @include background-image(linear-gradient($direction, color_stops(
  63. adjust-color($bg-color, $hue: -212.903deg, $saturation: -88.571%, $lightness: 6.863%),
  64. adjust-color($bg-color, $hue: 0.43deg, $saturation: -6.753%, $lightness: 4.706%) 25%,
  65. $bg-color 45%
  66. )));
  67. } @else if $type == tab-over {
  68. @include background-image(linear-gradient($direction, color_stops(
  69. adjust-color($bg-color, $hue: 4.462deg, $saturation: -9.524%, $lightness: -3.725%),
  70. adjust-color($bg-color, $hue: 2.272deg, $saturation: 0.0%, $lightness: -1.569%) 25%,
  71. $bg-color 45%
  72. )));
  73. } @else if $type == tab-disabled {
  74. @include background-image(linear-gradient($direction, color_stops(
  75. $bg-color,
  76. adjust-color($bg-color, $hue: -0.267deg, $saturation: 18.571%, $lightness: 2.941%)
  77. )));
  78. } @else if $type == grid-header {
  79. @include background-image(linear-gradient($direction, color_stops(
  80. adjust-color($bg-color, $hue: 0deg, $saturation: 0%, $lightness: 20.392%),
  81. adjust-color($bg-color, $hue: 220.0deg, $saturation: 5.66%, $lightness: 12.353%)
  82. )));
  83. } @else if $type == grid-header-over {
  84. @include background-image(linear-gradient($direction, color_stops(
  85. adjust-color($bg-color, $hue: 0.175deg, $saturation: 0.967%, $lightness: 14.118%),
  86. adjust-color($bg-color, $hue: 0.175deg, $saturation: 0.967%, $lightness: 14.118%) 39%,
  87. adjust-color($bg-color, $hue: 0.372deg, $saturation: 0.101%, $lightness: 10.196%) 40%,
  88. adjust-color($bg-color, $hue: 0.372deg, $saturation: 0.101%, $lightness: 10.196%)
  89. )));
  90. } @else if $type == grid-row-over {
  91. @include background-image(linear-gradient($direction, color_stops(
  92. adjust-color($bg-color, $hue: 0.175deg, $saturation: 0.967%, $lightness: 14.118%),
  93. $bg-color
  94. )));
  95. } @else if $type == grid-cell-special {
  96. @include background-image(linear-gradient(left, color_stops(
  97. $bg-color,
  98. darken($bg-color, 5)
  99. )));
  100. } @else if $type == glossy-button or $type == glossy-button-disabled {
  101. @include background-image(linear-gradient($direction, color_stops(
  102. $bg-color,
  103. adjust-color($bg-color, $hue: 0deg, $saturation: 0%, $lightness: -2.353%) 48%,
  104. adjust-color($bg-color, $hue: 0deg, $saturation: 0%, $lightness: -11.373%) 52%,
  105. adjust-color($bg-color, $hue: 0deg, $saturation: 0%, $lightness: -9.412%)
  106. )));
  107. } @else if $type == glossy-button-over {
  108. @include background-image(linear-gradient($direction, color_stops(
  109. $bg-color,
  110. adjust-color($bg-color, $hue: 1.754deg, $saturation: 0.0%, $lightness: -2.157%) 48%,
  111. adjust-color($bg-color, $hue: 5.833deg, $saturation: -35.135%, $lightness: -9.216%) 52%,
  112. adjust-color($bg-color, $hue: 5.833deg, $saturation: -27.273%, $lightness: -7.647%)
  113. )));
  114. } @else if $type == glossy-button-pressed {
  115. @include background-image(linear-gradient($direction, color_stops(
  116. $bg-color,
  117. adjust-color($bg-color, $hue: -1.839deg, $saturation: -2.18%, $lightness: 2.157%) 48%,
  118. adjust-color($bg-color, $hue: -2.032deg, $saturation: 37.871%, $lightness: -4.706%) 52%,
  119. adjust-color($bg-color, $hue: -1.641deg, $saturation: 36.301%, $lightness: -2.549%)
  120. )));
  121. }
  122. }
  123. }