Created
June 10, 2019 11:43
-
-
Save Psvensso/e2d8cb7a46422a0731d5991d1547d0d4 to your computer and use it in GitHub Desktop.
Generate color ranges
This file contains hidden or 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
type GetColorArgs = { index: number; outOf: number; }; | |
export function getColor({ index, outOf }: GetColorArgs) { | |
if (outOf < 1) { | |
outOf = 1; | |
} | |
return "hsl(" + (index * (360 / outOf) % 360) + ",100%,50%)"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment