| 1 |
@mixin linear-gradient($pos, $g1, $g2: null, |
| 2 |
$g3: null, $g4: null, |
| 3 |
$g5: null, $g6: null, |
| 4 |
$g7: null, $g8: null, |
| 5 |
$g9: null, $g10: null, |
| 6 |
$fallback: null) { |
| 7 |
@include _bourbon-deprecate-for-prefixing("linear-gradient"); |
| 8 |
|
| 9 |
// Detect what type of value exists in $pos |
| 10 |
$pos-type: type-of(nth($pos, 1)); |
| 11 |
$pos-spec: null; |
| 12 |
$pos-degree: null; |
| 13 |
|
| 14 |
// If $pos is missing from mixin, reassign vars and add default position |
| 15 |
@if ($pos-type == color) or (nth($pos, 1) == "transparent") { |
| 16 |
$g10: $g9; $g9: $g8; $g8: $g7; $g7: $g6; $g6: $g5; |
| 17 |
$g5: $g4; $g4: $g3; $g3: $g2; $g2: $g1; $g1: $pos; |
| 18 |
$pos: null; |
| 19 |
} |
| 20 |
|
| 21 |
@if $pos { |
| 22 |
$positions: _linear-positions-parser($pos); |
| 23 |
$pos-degree: nth($positions, 1); |
| 24 |
$pos-spec: nth($positions, 2); |
| 25 |
} |
| 26 |
|
| 27 |
$full: $g1, $g2, $g3, $g4, $g5, $g6, $g7, $g8, $g9, $g10; |
| 28 |
|
| 29 |
// Set $g1 as the default fallback color |
| 30 |
$fallback-color: nth($g1, 1); |
| 31 |
|
| 32 |
// If $fallback is a color use that color as the fallback color |
| 33 |
@if (type-of($fallback) == color) or ($fallback == "transparent") { |
| 34 |
$fallback-color: $fallback; |
| 35 |
} |
| 36 |
|
| 37 |
background-color: $fallback-color; |
| 38 |
background-image: -webkit-linear-gradient($pos-degree $full); // Safari 5.1+, Chrome |
| 39 |
background-image: unquote("linear-gradient(#{$pos-spec}#{$full})"); |
| 40 |
} |