13693261870
2022-09-16 354b3dbfbffb3df45212a2a44dbbf48b4acc2594
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
<!DOCTYPE html>
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <title>The source code</title>
  <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
  <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
  <style type="text/css">
    .highlight { display: block; background-color: #ddd; }
  </style>
  <script type="text/javascript">
    function highlight() {
      document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
    }
  </script>
</head>
<body onload="prettyPrint(); highlight();">
  <pre class="prettyprint lang-js">@function linear-gradient-bevel($direction, $bg-color) {
    @return linear-gradient($direction, color_stops(
        lighten($bg-color, 15%),
        lighten($bg-color, 8%) 30%,
        $bg-color 65%,
        darken($bg-color, 6%)
    ));
}
 
@function linear-gradient-glossy($direction, $bg-color) {
    @return linear-gradient($direction, color_stops(
        lighten($bg-color, 15%),
        lighten($bg-color, 5%) 50%,
        $bg-color 51%,
        darken($bg-color, 5%)
    ));
}
 
@function linear-gradient-recessed($direction, $bg-color) {
    @return linear-gradient($direction, color_stops(
        darken($bg-color, 10%),
        darken($bg-color, 5%) 10%,
        $bg-color 65%,
        lighten($bg-color, .5%)
    ));
}
 
@function linear-gradient-matte($direction, $bg-color) {
    @return linear-gradient($direction, color_stops(
        lighten($bg-color, 3%),
        darken($bg-color, 4%)
    ));
}
 
@function linear-gradient-matte-reverse($direction, $bg-color) {
    @return linear-gradient($direction, color_stops(
        darken($bg-color, 6%),
        lighten($bg-color, 4%)
    ));
}
 
@function linear-gradient-panel-header($direction, $bg-color) {
    @return linear-gradient($direction, color_stops(
        adjust-color($bg-color, $hue: -0.857deg, $saturation: -1.63%, $lightness: 3.529%),
        adjust-color($bg-color, $hue: 0.158deg, $saturation: -1.21%, $lightness: 0.392%) 45%,
        adjust-color($bg-color, $hue: 1.154deg, $saturation: 0.607%, $lightness: -7.647%) 46%,
        adjust-color($bg-color, $hue: 1.154deg, $saturation: 0.607%, $lightness: -7.647%) 50%,
        adjust-color($bg-color, $hue: 1.444deg, $saturation: -1.136%, $lightness: -4.706%) 51%,
        $bg-color
    ));
}
 
@function linear-gradient-tabbar($direction, $bg-color) {
    @return linear-gradient($direction, color_stops(
        adjust-color($bg-color, $hue: 0.0deg, $saturation: 1.604%, $lightness: 4.706%),
        $bg-color
    ));
}
 
@function linear-gradient-tab($direction, $bg-color) {
    @return linear-gradient($direction, color_stops(
        adjust-color($bg-color, $hue: 1.382deg, $saturation: -18.571%, $lightness: -4.902%),
        adjust-color($bg-color, $hue: 0.43deg, $saturation: -10.311%, $lightness: -2.157%) 25%,
        $bg-color 45%
    ));
}
 
@function linear-gradient-tab-active($direction, $bg-color) {
    @return linear-gradient($direction, color_stops(
        adjust-color($bg-color, $hue: -212.903deg, $saturation: -88.571%, $lightness: 6.863%),
        adjust-color($bg-color, $hue: 0.43deg, $saturation: -6.753%, $lightness: 4.706%) 25%,
        $bg-color 45%
    ));
}
 
@function linear-gradient-tab-over($direction, $bg-color) {
    @return linear-gradient($direction, color_stops(
        adjust-color($bg-color, $hue: 4.462deg, $saturation: -9.524%, $lightness: -3.725%),
        adjust-color($bg-color, $hue: 2.272deg, $saturation: 0.0%, $lightness: -1.569%) 25%,
        $bg-color 45%
    ));
}
 
@function linear-gradient-tab-disabled($direction, $bg-color) {
    @return linear-gradient($direction, color_stops(
        $bg-color,
        adjust-color($bg-color, $hue: -0.267deg, $saturation: 18.571%, $lightness: 2.941%)
    ));
}
 
@function linear-gradient-grid-header($direction, $bg-color) {
    @return linear-gradient($direction, color_stops(
        adjust-color($bg-color, $hue: 0deg, $saturation: 0%, $lightness: 20.392%),
        adjust-color($bg-color, $hue: 220.0deg, $saturation: 5.66%, $lightness: 12.353%)
    ));
}
 
@function linear-gradient-grid-header-over($direction, $bg-color) {
    @return linear-gradient($direction, color_stops(
        adjust-color($bg-color, $hue: 0.175deg, $saturation: 0.967%, $lightness: 14.118%),
        adjust-color($bg-color, $hue: 0.175deg, $saturation: 0.967%, $lightness: 14.118%) 39%,
        adjust-color($bg-color, $hue: 0.372deg, $saturation: 0.101%, $lightness: 10.196%) 40%,
        adjust-color($bg-color, $hue: 0.372deg, $saturation: 0.101%, $lightness: 10.196%)
    ));
}
 
@function linear-gradient-grid-row-over($direction, $bg-color) {
    @return linear-gradient($direction, color_stops(
        adjust-color($bg-color, $hue: 0.175deg, $saturation: 0.967%, $lightness: 14.118%),
        $bg-color
    ));
}
 
@function linear-gradient-grid-cell-special($direction, $bg-color) {
    @return linear-gradient($direction, color_stops(
        $bg-color,
        darken($bg-color, 5)
    ));
}
 
@function linear-gradient-glossy-button($direction, $bg-color) {
    @return linear-gradient($direction, color_stops(
        $bg-color,
        adjust-color($bg-color, $hue: 0deg, $saturation: 0%, $lightness: -2.353%) 48%,
        adjust-color($bg-color, $hue: 0deg, $saturation: 0%, $lightness: -11.373%) 52%,
        adjust-color($bg-color, $hue: 0deg, $saturation: 0%, $lightness: -9.412%)
    ));
}
 
@function linear-gradient-glossy-button-over($direction, $bg-color) {
    @return linear-gradient($direction, color_stops(
        $bg-color,
        adjust-color($bg-color, $hue: 1.754deg, $saturation: 0.0%, $lightness: -2.157%) 48%,
        adjust-color($bg-color, $hue: 5.833deg, $saturation: -35.135%, $lightness: -9.216%) 52%,
        adjust-color($bg-color, $hue: 5.833deg, $saturation: -27.273%, $lightness: -7.647%)
    ));
}
 
@function linear-gradient-glossy-button-pressed($direction, $bg-color) {
    @return linear-gradient($direction, color_stops(
        $bg-color,
        adjust-color($bg-color, $hue: -1.839deg, $saturation: -2.18%, $lightness: 2.157%) 48%,
        adjust-color($bg-color, $hue: -2.032deg, $saturation: 37.871%, $lightness: -4.706%) 52%,
        adjust-color($bg-color, $hue: -1.641deg, $saturation: 36.301%, $lightness: -2.549%)
    ));
}
 
<span id='Global_CSS-css_mixin-background-gradient'>/**
</span> * Creates a background gradient.
 *
 * Example usage:
 *     .foo {
 *          @include background-gradient(#808080, matte, left);
 *     }
 *
 * @param {Color} $bg-color The background color of the gradient
 * @param {String/List} [$type=$base-gradient] The type of gradient to be used. Can either
 * be a String which is a predefined gradient name, or it can can be a list of color stops.
 * If null is passed, this mixin will still set the `background-color` to $bg-color.
 * The available predefined gradient names are:
 *
 * * bevel
 * * glossy
 * * recessed
 * * matte
 * * matte-reverse
 * * panel-header
 * * tabbar
 * * tab
 * * tab-active
 * * tab-over
 * * tab-disabled
 * * grid-header
 * * grid-header-over
 * * grid-row-over
 * * grid-cell-special
 * * glossy-button
 * * glossy-button-over
 * * glossy-button-pressed
 *
 * Each of these gradient names corresponds to a function named linear-gradient[name].
 * Themes can override these functions to customize the color stops that they return.
 * For example, to override the glossy-button gradient function add a function named
 * &quot;linear-gradient-glossy-button&quot; to a file named &quot;sass/etc/mixins/background-gradient.scss&quot;
 * in your theme.  The function should return the result of calling the Compass linear-gradient
 * function with the desired direction and color-stop information for the gradient.  For example:
 *
 *     @function linear-gradient-glossy-button($direction, $bg-color) {
 *         @return linear-gradient($direction, color_stops(
 *             mix(#fff, $bg-color, 10%),
 *             $bg-color 50%,
 *             mix(#000, $bg-color, 5%) 51%,
 *             $bg-color
 *         ));
 *     }
 *
 * @param {String} [$direction=top] The direction of the gradient. Can either be
 * `top` or `left`.
 *
 * @member Global_CSS
 */
@mixin background-gradient($bg-color, $type: $base-gradient, $direction: top) {
    background-image: none;
    background-color: $bg-color;
 
    @if $base-gradient != null and $bg-color != transparent {
        $gradient: null;
 
        //color_stops
        @if type-of($type) == &quot;list&quot; {
            $gradient: linear-gradient($direction, $type);
        }
 
        //default gradients
        @else if $type == bevel {
            $gradient: linear-gradient-bevel($direction, $bg-color);
        } @else if $type == glossy {
            $gradient: linear-gradient-glossy($direction, $bg-color);
        } @else if $type == recessed {
            $gradient: linear-gradient-recessed($direction, $bg-color);
        } @else if $type == matte {
            $gradient: linear-gradient-matte($direction, $bg-color);
        } @else if $type == matte-reverse {
            $gradient: linear-gradient-matte-reverse($direction, $bg-color);
        }
 
        // gradients
        @else if $type == panel-header {
            $gradient: linear-gradient-panel-header($direction, $bg-color);
        } @else if $type == tabbar {
            $gradient: linear-gradient-tabbar($direction, $bg-color);
        } @else if $type == tab {
            $gradient: linear-gradient-tab($direction, $bg-color);
        } @else if $type == tab-active {
            $gradient: linear-gradient-tab-active($direction, $bg-color);
        } @else if $type == tab-over {
            $gradient: linear-gradient-tab-over($direction, $bg-color);
        } @else if $type == tab-disabled {
            $gradient: linear-gradient-tab-disabled($direction, $bg-color);
        } @else if $type == grid-header {
            $gradient: linear-gradient-grid-header($direction, $bg-color);
        } @else if $type == grid-header-over {
            $gradient: linear-gradient-grid-header-over($direction, $bg-color);
        } @else if $type == grid-row-over {
            $gradient: linear-gradient-grid-row-over($direction, $bg-color);
        } @else if $type == grid-cell-special {
            $gradient: linear-gradient-grid-cell-special($direction, $bg-color);
        } @else if $type == glossy-button or $type == glossy-button-disabled {
            $gradient: linear-gradient-glossy-button($direction, $bg-color);
        } @else if $type == glossy-button-over {
            $gradient: linear-gradient-glossy-button-over($direction, $bg-color);
        } @else if $type == glossy-button-pressed {
            $gradient: linear-gradient-glossy-button-pressed($direction, $bg-color);
        }
 
        @if $gradient != null {
            @include background-image($gradient);
        }
    }
}</pre>
</body>
</html>