Last active
March 14, 2021 14:43
-
-
Save robrakaric/d74a3ae73eafacdcb6fe72c7bd897bdd to your computer and use it in GitHub Desktop.
Sass function that takes a base color (html, rgb, or hsl) and number to calculate a rainbow color palette of colors equidistant from each other in the color spectrum
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
@function rainbowColors($base-color, $number-of-colors) { | |
$color-list: ($base-color); | |
$degrees: 360/$number_of_colors; | |
@for $i from 1 through $number_of_colors - 1 { | |
$color-list: append($color-list, adjust-hue($base-color, $degrees * $i), comma) | |
} | |
@return $color-list; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment