@import "compass/css3/images";
$default-gradient: matte !default;
$support-for-original-webkit-gradients: false;
@mixin background-gradient($bg-color, $type: $default-gradient, $direction: top, $contrast: 1) {
$flat: $type == null or $type == none or $type == flat;
@if $flat or ($bg-color == transparent) {
background-color: $bg-color;
@if $bg-color != null {
background-image: none;
}
}
@if not ($flat or ($bg-color == transparent)) {
@if type-of($type) == "list" {
@include background-image(linear-gradient($direction, $type));
} @else if $bg-color != transparent {
@if $bg-color == null {
@warn '@background-gradient: $bg-color is required for named gradient "#{$type}"';
} @else if $type == bevel {
@include background-image(bevel-gradient($bg-color, $direction, $contrast));
} @else if $type == glossy {
@include background-image(glossy-gradient($bg-color, $direction, $contrast));
} @else if $type == recessed {
@include background-image(recessed-gradient($bg-color, $direction, $contrast));
} @else if $type == linear {
@include background-image(linear-gradient($direction, color_stops(lighten($bg-color, 5%), darken($bg-color, 10%))));
} @else if $type == matte {
@include background-image(matte-gradient($bg-color, $direction, $contrast));
} @else {
@warn '@background-gradient: invalid gradient name "#{$type}"';
}
}
}
}
@function bevel-gradient($bg-color: $base-color, $direction: top, $contrast: 1) {
@return linear-gradient($direction, color_stops(
lighten($bg-color, 15%),
lighten($bg-color, 8%) 30%,
$bg-color 65%,
darken($bg-color, 6%)
));
}
@function glossy-gradient($bg-color: $base-color, $direction: top, $contrast: 1) {
@return linear-gradient($direction, color_stops(lighten($bg-color, 15% * $contrast), lighten($bg-color, 5% * $contrast) 50%, $bg-color 51%, darken($bg-color, 5% * $contrast)));
}
@function recessed-gradient($bg-color: $base-color, $direction: top, $contrast: 1) {
@return linear-gradient($direction, color_stops(darken($bg-color, 10% * $contrast), darken($bg-color, 5% * $contrast) 10%, $bg-color 65%, lighten($bg-color, .5% * $contrast)));
}
@function matte-gradient (
$bg-color: $base-color,
$direction: top,
$contrast: 1
) {
@return linear-gradient(
$direction,
color_stops(
lighten($bg-color, 15% * $contrast),
lighten($bg-color, 5% * $contrast) 3%,
darken($bg-color, 5% * $contrast)
)
);
}