/**
* Creates a background gradient.
*
* @param {Color} $bg-color The background color of the gradient
* @param {String/List} [$type] The type of gradient to be used. Can either
* be a String which is a predefined gradient, or it can can be a list of
* color_stops. If none is set, it will still set the `background-color`
* to the $background-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 {
//color_stops
@if type-of($type) == "list" {
@include background-image(linear-gradient($direction, $type));
}
//default gradients
@else if $type == bevel {
@include background-image(linear-gradient($direction, color_stops(
lighten($bg-color, 15%),
lighten($bg-color, 8%) 30%,
$bg-color 65%,
darken($bg-color, 6%)
)));
} @else if $type == bootstrap {
@include background-image(linear-gradient($direction, color_stops($bg-color, darken($bg-color, 5))));
} @else if $type == glossy {
@include background-image(linear-gradient($direction, color_stops(lighten($bg-color, 15%), lighten($bg-color, 5%) 50%, $bg-color 51%, darken($bg-color, 5%))));
} @else if $type == recessed {
@include background-image(linear-gradient($direction, color_stops(darken($bg-color, 10%), darken($bg-color, 5%) 10%, $bg-color 65%, lighten($bg-color, .5%))));
} @else if $type == matte {
@include background-image(linear-gradient($direction, color_stops(lighten($bg-color, 3%), darken($bg-color, 4%))));
} @else if $type == matte-reverse {
@include background-image(linear-gradient($direction, color_stops(darken($bg-color, 6%), lighten($bg-color, 4%))));
} @else if $type == glossy-toolbar {
@include background-image(linear-gradient($direction, color_stops(#F0F5FA, #DAE6F4 2%, #CEDDEF)));
}
//ext3.3 gradients
@else if $type == panel-header {
@include background-image(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
)));
} @else if $type == tabbar {
@include background-image(linear-gradient($direction, color_stops(
adjust-color($bg-color, $hue: 0.0deg, $saturation: 1.604%, $lightness: 4.706%),
$bg-color
)));
} @else if $type == tab {
@include background-image(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%
)));
} @else if $type == tab-active {
@include background-image(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%
)));
} @else if $type == tab-over {
@include background-image(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%
)));
} @else if $type == tab-disabled {
@include background-image(linear-gradient($direction, color_stops(
$bg-color,
adjust-color($bg-color, $hue: -0.267deg, $saturation: 18.571%, $lightness: 2.941%)
)));
} @else if $type == grid-header {
@include background-image(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%)
)));
} @else if $type == grid-header-over {
@include background-image(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%)
)));
} @else if $type == grid-row-over {
@include background-image(linear-gradient($direction, color_stops(
adjust-color($bg-color, $hue: 0.175deg, $saturation: 0.967%, $lightness: 14.118%),
$bg-color
)));
} @else if $type == grid-cell-special {
@include background-image(linear-gradient(left, color_stops(
$bg-color,
darken($bg-color, 5)
)));
} @else if $type == bootstrap-button or $type == bootstrap-button-disabled {
@include background-image(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%)
)));
} @else if $type == bootstrap-button-over {
@include background-image(linear-gradient($direction, color_stops(
adjust-color($bg-color, $hue: 0deg, $saturation: 0%, $lightness: 10.392%),
adjust-color($bg-color, $hue: 220.0deg, $saturation: 5.66%, $lightness: 2.353%)
)));
} @else if $type == bootstrap-button-pressed {
@include background-image(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%)
)));
}
// Button bar background gradient
@else if $type == button-primary {
@include background-image(linear-gradient($direction, color_stops(
$btnPrimaryBackground,
$btnPrimaryBackgroundHighlight
)));
}
// Button bar defaut
@else if $type == button-default {
@include background-image(linear-gradient($direction, color_stops(
$btnBackground,
$btnBackgroundHighlight
)));
}
// Button bar danger
@else if $type == button-danger {
@include background-image(linear-gradient($direction, color_stops(
$btnDangerBackground,
$btnDangerBackgroundHighlight
)));
}
// Button bar success
@else if $type == button-success {
@include background-image(linear-gradient($direction, color_stops(
$btnSuccessBackground,
$btnSuccessBackgroundHighlight
)));
}
// Button bar info
@else if $type == button-info {
@include background-image(linear-gradient($direction, color_stops(
$btnInfoBackground,
$btnInfoBackgroundHighlight
)));
}
// Button bar warning
@else if $type == button-warning {
@include background-image(linear-gradient($direction, color_stops(
$btnWarningBackground,
$btnWarningBackgroundHighlight
)));
}
// Button bar inverse
@else if $type == button-inverse {
@include background-image(linear-gradient($direction, color_stops(
$btnInverseBackground,
$btnInverseBackgroundHighlight
)));
}
// Progress bar background gradient
@else if $type == progress-background {
@include background-image(linear-gradient($direction, color_stops(
#f5f5f5,
#f9f9f9
)));
}
// Progress bar defaut
@else if $type == progress-default {
@include background-image(linear-gradient($direction, color_stops(
#149bdf,
#0480be
)));
}
// Progress bar danger
@else if $type == progress-danger {
@include background-image(linear-gradient($direction, color_stops(
#ee5f5b,
#c43c35
)));
}
// Progress bar success
@else if $type == progress-success {
@include background-image(linear-gradient($direction, color_stops(
#62c462,
#57a957
)));
}
// Progress bar info
@else if $type == progress-info {
@include background-image(linear-gradient($direction, color_stops(
#5bc0de,
#339bb9
)));
}
// Progress bar warning
@else if $type == progress-warning {
@include background-image(linear-gradient($direction, color_stops(
lighten($orange, 15%),
$orange
)));
}
}
}
|