/ext-4.1.0_b3/resources/themes/stylesheets/ext4/default/mixins/_background-gradient.scss

https://bitbucket.org/srogerf/javascript · Sass · 122 lines · 108 code · 3 blank · 11 comment · 42 complexity · cc324215c67acf94ee7ed5f3accd0826 MD5 · raw file

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