-
-
Notifications
You must be signed in to change notification settings - Fork 879
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactored deprecated-gradient decleration. Added support for radial-…
…gradient
- Loading branch information
Phil LaPier
committed
Oct 14, 2011
1 parent
5e4cea2
commit f54da8f
Showing
4 changed files
with
39 additions
and
44 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
36 changes: 36 additions & 0 deletions
36
app/assets/stylesheets/functions/_deprecated-webkit-gradient.scss
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 |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// Render Deprecated Webkit Gradient - Linear || Radial | ||
//************************************************************************// | ||
@function deprecated-webkit-gradient($type, $full) { | ||
$gradient-list: (); | ||
$gradient: false; | ||
$full-length: length($full); | ||
$percentage: false; | ||
$gradient-type: $type; | ||
|
||
@for $i from 1 through $full-length { | ||
$gradient: nth($full, $i); | ||
|
||
@if length($gradient) == 2 { | ||
$color-stop: color-stop(nth($gradient, 2), nth($gradient, 1)); | ||
$gradient-list: join($gradient-list, $color-stop, comma); | ||
} | ||
@else { | ||
@if $i == $full-length { | ||
$percentage: 100%; | ||
} | ||
@else { | ||
$percentage: ($i - 1) * (100 / ($full-length - 1)) + "%"; | ||
} | ||
$color-stop: color-stop(unquote($percentage), $gradient); | ||
$gradient-list: join($gradient-list, $color-stop, comma); | ||
} | ||
} | ||
|
||
@if $type == radial { | ||
$gradient: -webkit-gradient(radial, center center, 0, center center, 460, $gradient-list); | ||
} | ||
@else if $type == linear { | ||
$gradient: -webkit-gradient(linear, left top, left bottom, $gradient-list); | ||
} | ||
@return $gradient; | ||
} |