_radial-gradient.scss (1387B)
1 // Requires Sass 3.1+ 2 @mixin radial-gradient($g1, $g2, 3 $g3: null, $g4: null, 4 $g5: null, $g6: null, 5 $g7: null, $g8: null, 6 $g9: null, $g10: null, 7 $pos: null, 8 $shape-size: null, 9 $fallback: null) { 10 11 $data: _radial-arg-parser($g1, $g2, $pos, $shape-size); 12 $g1: nth($data, 1); 13 $g2: nth($data, 2); 14 $pos: nth($data, 3); 15 $shape-size: nth($data, 4); 16 17 $full: $g1, $g2, $g3, $g4, $g5, $g6, $g7, $g8, $g9, $g10; 18 19 // Strip deprecated cover/contain for spec 20 $shape-size-spec: _shape-size-stripper($shape-size); 21 22 // Set $g1 as the default fallback color 23 $first-color: nth($full, 1); 24 $fallback-color: nth($first-color, 1); 25 26 @if (type-of($fallback) == color) or ($fallback == "transparent") { 27 $fallback-color: $fallback; 28 } 29 30 // Add Commas and spaces 31 $shape-size: if($shape-size, "#{$shape-size}, ", null); 32 $pos: if($pos, "#{$pos}, ", null); 33 $pos-spec: if($pos, "at #{$pos}", null); 34 $shape-size-spec: if(($shape-size-spec != " ") and ($pos == null), "#{$shape-size-spec}, ", "#{$shape-size-spec} "); 35 36 background-color: $fallback-color; 37 background-image: -webkit-radial-gradient(#{$pos}#{$shape-size}#{$full}); 38 background-image: radial-gradient(#{$shape-size-spec}#{$pos-spec}#{$full}); 39 }