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