forked from thoughtbot/bourbon
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Carry over improved radial-gradient mixin to radial-gradient function
- Loading branch information
Phil LaPier
committed
Mar 16, 2012
1 parent
cb8b731
commit e2c505f
Showing
3 changed files
with
79 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,62 @@ | ||
// This function is required and used by the background-image mixin. | ||
@function radial-gradient($pos, $shape-size, | ||
$G1, $G2, | ||
@function radial-gradient($G1, $G2, | ||
$G3: false, $G4: false, | ||
$G5: false, $G6: false, | ||
$G7: false, $G8: false, | ||
$G9: false, $G10: false) { | ||
$G9: false, $G10: false, | ||
$pos: 50% 50%, | ||
$shape-size: ellipse cover, | ||
$deprecated-pos1: center center, | ||
$deprecated-pos2: center center, | ||
$deprecated-radius1: 0, | ||
$deprecated-radius2: 50, | ||
$fallback: false) { | ||
|
||
@each $value in $G1, $G2 { | ||
$first-val: nth($value, 1); | ||
$pos-type: type-of($first-val); | ||
|
||
@if ($pos-type != color) or ($first-val != "transparent") { | ||
@if ($pos-type == number) | ||
or ($first-val == "center") | ||
or ($first-val == "top") | ||
or ($first-val == "right") | ||
or ($first-val == "bottom") | ||
or ($first-val == "left") { | ||
|
||
$pos: $value; | ||
|
||
@if $pos == $G1 { | ||
$G1: false; | ||
} | ||
} | ||
|
||
@else if | ||
($first-val == "ellipse") | ||
or ($first-val == "circle") | ||
or ($first-val == "closest-side") | ||
or ($first-val == "closest-corner") | ||
or ($first-val == "farthest-side") | ||
or ($first-val == "farthest-corner") | ||
or ($first-val == "contain") | ||
or ($first-val == "cover") { | ||
|
||
$shape-size: $value; | ||
|
||
@if $value == $G1 { | ||
$G1: false; | ||
} | ||
|
||
@else if $value == $G2 { | ||
$G2: false; | ||
} | ||
} | ||
} | ||
} | ||
|
||
$type: radial; | ||
$gradient: compact($pos, $shape-size, $G1, $G2, $G3, $G4, $G5, $G6, $G7, $G8, $G9, $G10); | ||
$type-gradient: append($type, $gradient, comma); | ||
|
||
@return $type-gradient; | ||
} | ||
|