Skip to content

Instantly share code, notes, and snippets.

@robrakaric
Last active March 14, 2021 14:43
Show Gist options
  • Save robrakaric/d74a3ae73eafacdcb6fe72c7bd897bdd to your computer and use it in GitHub Desktop.
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
@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