| 1 |
// Requires Sass 3.1+ |
| 2 |
@mixin radial-gradient($G1, $G2, |
| 3 |
$G3: false, $G4: false, |
| 4 |
$G5: false, $G6: false, |
| 5 |
$G7: false, $G8: false, |
| 6 |
$G9: false, $G10: false, |
| 7 |
$pos: null, |
| 8 |
$shape-size: null, |
| 9 |
$deprecated-pos1: center center, |
| 10 |
$deprecated-pos2: center center, |
| 11 |
$deprecated-radius1: 0, |
| 12 |
$deprecated-radius2: 460, |
| 13 |
$fallback: false) { |
| 14 |
|
| 15 |
$data: _radial-arg-parser($G1, $G2, $pos, $shape-size); |
| 16 |
$G1: nth($data, 1); |
| 17 |
$G2: nth($data, 2); |
| 18 |
$pos: nth($data, 3); |
| 19 |
$shape-size: nth($data, 4); |
| 20 |
|
| 21 |
$full: compact($G1, $G2, $G3, $G4, $G5, $G6, $G7, $G8, $G9, $G10); |
| 22 |
|
| 23 |
// Strip deprecated cover/contain for spec |
| 24 |
$shape-size-spec: _shape-size-stripper($shape-size); |
| 25 |
|
| 26 |
// Set $G1 as the default fallback color |
| 27 |
$first-color: nth($full, 1); |
| 28 |
$fallback-color: nth($first-color, 1); |
| 29 |
|
| 30 |
@if (type-of($fallback) == color) or ($fallback == "transparent") { |
| 31 |
$fallback-color: $fallback; |
| 32 |
} |
| 33 |
|
| 34 |
// Add Commas and spaces |
| 35 |
$shape-size: if($shape-size, '#{$shape-size}, ', null); |
| 36 |
$pos: if($pos, '#{$pos}, ', null); |
| 37 |
$pos-spec: if($pos, 'at #{$pos}', null); |
| 38 |
$shape-size-spec: if(($shape-size-spec != ' ') and ($pos == null), '#{$shape-size-spec}, ', '#{$shape-size-spec} '); |
| 39 |
|
| 40 |
background-color: $fallback-color; |
| 41 |
background-image: _deprecated-webkit-gradient(radial, $deprecated-pos1, $deprecated-pos2, $full, $deprecated-radius1, $deprecated-radius2); // Safari <= 5.0 && IOS 4 |
| 42 |
background-image: -webkit-radial-gradient(unquote(#{$pos}#{$shape-size}#{$full})); |
| 43 |
background-image: unquote("radial-gradient(#{$shape-size-spec}#{$pos-spec}#{$full})"); |
| 44 |
} |