Created
December 5, 2013 23:33
-
-
Save pdaoust/7816120 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
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
// ---- | |
// Sass (v3.3.0.rc.1) | |
// Compass (v0.13.alpha.10) | |
// ---- | |
@function f-fold($func, $list, $initial, $args...) { | |
$start: 1; | |
@if $initial == null { | |
// If there's no initial value, use the first in the list. | |
$start: 2; | |
$initial: nth($list, 1); | |
} | |
$prev: $initial; | |
@for $i from $start through length($list) { | |
$next: nth($list, $i); | |
$prev: call($func, $prev, $next, $args...); | |
} | |
@return $prev; | |
} | |
p { | |
$colors: red green blue orange; | |
colors: $colors; | |
mixed-color: f-fold(mix, $colors, null, 50%); | |
} |
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
p { | |
colors: red green blue orange; | |
mixed-color: #9f623f; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment