Last active
August 29, 2015 14:00
-
-
Save pnts/248725b49d7b054e84ae to your computer and use it in GitHub Desktop.
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
// set up the color stops - mess with these to change the gradient | |
$color-stop-1: hsl(107, 41.0526%, 62.7451%); | |
$color-stop-2: hsl(177, 42.9752%, 52.5490%); | |
$color-stop-3: hsl(263, 30.0000%, 60.7843%); | |
$color-stop-4: hsl(360, 74.8792%, 59.4118%); | |
// set up percentile ranges | |
$top-tier: sequence(67, 99); | |
$mid-tier: sequence(34, 66); | |
$bottom-tier: sequence(1, 33); | |
// mixin to mix the colors and assign them to a class | |
@mixin tileStyle($color1, $color2, $range) { | |
@for $i from first($range) through last($range) { | |
$value: index($range, $i) / length($range) * 100; | |
$shade: darken(mix($color1, $color2, $value), 15%); | |
.percentile-#{$i} { | |
background: mix($color1, $color2, $value); | |
.number { | |
text-shadow: .080em .080em $shade; | |
} | |
} | |
} | |
} | |
// call the mixin for each percentile grouping | |
.table { | |
@include tileStyle($color-stop-1, $color-stop-2, $top-tier); | |
@include tileStyle($color-stop-2, $color-stop-3, $mid-tier); | |
@include tileStyle($color-stop-3, $color-stop-4, $bottom-tier); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment