| 1 |
@mixin linear-gradient($pos, $G1, $G2: false, |
| 2 |
$G3: false, $G4: false, |
| 3 |
$G5: false, $G6: false, |
| 4 |
$G7: false, $G8: false, |
| 5 |
$G9: false, $G10: false, |
| 6 |
$deprecated-pos1: left top, |
| 7 |
$deprecated-pos2: left bottom, |
| 8 |
$fallback: false) { |
| 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: compact($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: _deprecated-webkit-gradient(linear, $deprecated-pos1, $deprecated-pos2, $full); // Safari <= 5.0 |
| 39 |
background-image: -webkit-linear-gradient($pos-degree $full); // Safari 5.1+, Chrome |
| 40 |
background-image: unquote("linear-gradient(#{$pos-spec}#{$full})"); |
| 41 |
} |