_background-gradient.scss.html 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. <title>The source code</title>
  6. <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
  7. <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
  8. <style type="text/css">
  9. .highlight { display: block; background-color: #ddd; }
  10. </style>
  11. <script type="text/javascript">
  12. function highlight() {
  13. document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
  14. }
  15. </script>
  16. </head>
  17. <body onload="prettyPrint(); highlight();">
  18. <pre class="prettyprint lang-js"><span id='Global_CSS-css_mixin-background-gradient'>/**
  19. </span> * Creates a background gradient.
  20. *
  21. * @param {Color} $bg-color The background color of the gradient
  22. * @param {String/List} [$type] The type of gradient to be used. Can either
  23. * be a String which is a predefined gradient, or it can can be a list of
  24. * color_stops. If none is set, it will still set the `background-color`
  25. * to the $background-color.
  26. * @param {String} [$direction=top] The direction of the gradient. Can either be
  27. * `top` or `left`.
  28. * @member Global_CSS
  29. */
  30. @mixin background-gradient($bg-color, $type: $base-gradient, $direction: top) {
  31. background-image: none;
  32. background-color: $bg-color;
  33. @if $base-gradient != null and $bg-color != transparent {
  34. //color_stops
  35. @if type-of($type) == &quot;list&quot; {
  36. @include background-image(linear-gradient($direction, $type));
  37. }
  38. //default gradients
  39. @else if $type == bevel {
  40. @include background-image(linear-gradient($direction, color_stops(
  41. lighten($bg-color, 15%),
  42. lighten($bg-color, 8%) 30%,
  43. $bg-color 65%,
  44. darken($bg-color, 6%)
  45. )));
  46. } @else if $type == glossy {
  47. @include background-image(linear-gradient($direction, color_stops(lighten($bg-color, 15%), lighten($bg-color, 5%) 50%, $bg-color 51%, darken($bg-color, 5%))));
  48. } @else if $type == recessed {
  49. @include background-image(linear-gradient($direction, color_stops(darken($bg-color, 10%), darken($bg-color, 5%) 10%, $bg-color 65%, lighten($bg-color, .5%))));
  50. } @else if $type == matte {
  51. @include background-image(linear-gradient($direction, color_stops(lighten($bg-color, 3%), darken($bg-color, 4%))));
  52. } @else if $type == matte-reverse {
  53. @include background-image(linear-gradient($direction, color_stops(darken($bg-color, 6%), lighten($bg-color, 4%))));
  54. } @else if $type == glossy-toolbar {
  55. @include background-image(linear-gradient($direction, color_stops(#F0F5FA, #DAE6F4 2%, #CEDDEF)));
  56. }
  57. //ext3.3 gradients
  58. @else if $type == panel-header {
  59. @include background-image(linear-gradient($direction, color_stops(
  60. adjust-color($bg-color, $hue: -0.857deg, $saturation: -1.63%, $lightness: 3.529%),
  61. adjust-color($bg-color, $hue: 0.158deg, $saturation: -1.21%, $lightness: 0.392%) 45%,
  62. adjust-color($bg-color, $hue: 1.154deg, $saturation: 0.607%, $lightness: -7.647%) 46%,
  63. adjust-color($bg-color, $hue: 1.154deg, $saturation: 0.607%, $lightness: -7.647%) 50%,
  64. adjust-color($bg-color, $hue: 1.444deg, $saturation: -1.136%, $lightness: -4.706%) 51%,
  65. $bg-color
  66. )));
  67. } @else if $type == tabbar {
  68. @include background-image(linear-gradient($direction, color_stops(
  69. adjust-color($bg-color, $hue: 0.0deg, $saturation: 1.604%, $lightness: 4.706%),
  70. $bg-color
  71. )));
  72. } @else if $type == tab {
  73. @include background-image(linear-gradient($direction, color_stops(
  74. adjust-color($bg-color, $hue: 1.382deg, $saturation: -18.571%, $lightness: -4.902%),
  75. adjust-color($bg-color, $hue: 0.43deg, $saturation: -10.311%, $lightness: -2.157%) 25%,
  76. $bg-color 45%
  77. )));
  78. } @else if $type == tab-active {
  79. @include background-image(linear-gradient($direction, color_stops(
  80. adjust-color($bg-color, $hue: -212.903deg, $saturation: -88.571%, $lightness: 6.863%),
  81. adjust-color($bg-color, $hue: 0.43deg, $saturation: -6.753%, $lightness: 4.706%) 25%,
  82. $bg-color 45%
  83. )));
  84. } @else if $type == tab-over {
  85. @include background-image(linear-gradient($direction, color_stops(
  86. adjust-color($bg-color, $hue: 4.462deg, $saturation: -9.524%, $lightness: -3.725%),
  87. adjust-color($bg-color, $hue: 2.272deg, $saturation: 0.0%, $lightness: -1.569%) 25%,
  88. $bg-color 45%
  89. )));
  90. } @else if $type == tab-disabled {
  91. @include background-image(linear-gradient($direction, color_stops(
  92. $bg-color,
  93. adjust-color($bg-color, $hue: -0.267deg, $saturation: 18.571%, $lightness: 2.941%)
  94. )));
  95. } @else if $type == grid-header {
  96. @include background-image(linear-gradient($direction, color_stops(
  97. adjust-color($bg-color, $hue: 0deg, $saturation: 0%, $lightness: 20.392%),
  98. adjust-color($bg-color, $hue: 220.0deg, $saturation: 5.66%, $lightness: 12.353%)
  99. )));
  100. } @else if $type == grid-header-over {
  101. @include background-image(linear-gradient($direction, color_stops(
  102. adjust-color($bg-color, $hue: 0.175deg, $saturation: 0.967%, $lightness: 14.118%),
  103. adjust-color($bg-color, $hue: 0.175deg, $saturation: 0.967%, $lightness: 14.118%) 39%,
  104. adjust-color($bg-color, $hue: 0.372deg, $saturation: 0.101%, $lightness: 10.196%) 40%,
  105. adjust-color($bg-color, $hue: 0.372deg, $saturation: 0.101%, $lightness: 10.196%)
  106. )));
  107. } @else if $type == grid-row-over {
  108. @include background-image(linear-gradient($direction, color_stops(
  109. adjust-color($bg-color, $hue: 0.175deg, $saturation: 0.967%, $lightness: 14.118%),
  110. $bg-color
  111. )));
  112. } @else if $type == grid-cell-special {
  113. @include background-image(linear-gradient(left, color_stops(
  114. $bg-color,
  115. darken($bg-color, 5)
  116. )));
  117. } @else if $type == glossy-button or $type == glossy-button-disabled {
  118. @include background-image(linear-gradient($direction, color_stops(
  119. $bg-color,
  120. adjust-color($bg-color, $hue: 0deg, $saturation: 0%, $lightness: -2.353%) 48%,
  121. adjust-color($bg-color, $hue: 0deg, $saturation: 0%, $lightness: -11.373%) 52%,
  122. adjust-color($bg-color, $hue: 0deg, $saturation: 0%, $lightness: -9.412%)
  123. )));
  124. } @else if $type == glossy-button-over {
  125. @include background-image(linear-gradient($direction, color_stops(
  126. $bg-color,
  127. adjust-color($bg-color, $hue: 1.754deg, $saturation: 0.0%, $lightness: -2.157%) 48%,
  128. adjust-color($bg-color, $hue: 5.833deg, $saturation: -35.135%, $lightness: -9.216%) 52%,
  129. adjust-color($bg-color, $hue: 5.833deg, $saturation: -27.273%, $lightness: -7.647%)
  130. )));
  131. } @else if $type == glossy-button-pressed {
  132. @include background-image(linear-gradient($direction, color_stops(
  133. $bg-color,
  134. adjust-color($bg-color, $hue: -1.839deg, $saturation: -2.18%, $lightness: 2.157%) 48%,
  135. adjust-color($bg-color, $hue: -2.032deg, $saturation: 37.871%, $lightness: -4.706%) 52%,
  136. adjust-color($bg-color, $hue: -1.641deg, $saturation: 36.301%, $lightness: -2.549%)
  137. )));
  138. }
  139. }
  140. }</pre>
  141. </body>
  142. </html>