partkeepr

fork of partkeepr
git clone https://git.e1e0.net/partkeepr.git
Log | Files | Refs | Submodules | README | LICENSE

_background-gradient.scss (7195B)


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