Skip to content

Instantly share code, notes, and snippets.

@pedrozath
Created October 27, 2016 10:35
Show Gist options
  • Select an option

  • Save pedrozath/5f3afea185b2b4322df40f7d2a511fc0 to your computer and use it in GitHub Desktop.

Select an option

Save pedrozath/5f3afea185b2b4322df40f7d2a511fc0 to your computer and use it in GitHub Desktop.
@for $l from 0 through $color-levels
$progress: ($l / $color-levels) * ($n-colors - 1) + 1
$color-a-index: floor($progress)
$color-b-index: min($color-a-index + 1, $n-colors)
$color-a: nth($colors, $color-a-index)
$color-b: nth($colors, $color-b-index)
$mix: percentage($progress - $color-a-index)
$bg-color: mix($color-b, $color-a, $mix)
.color-level-#{$l}
background-color: $bg-color
color: readable-text-color($bg-color)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment