Skip to content

Instantly share code, notes, and snippets.

@Bouni
Created November 1, 2023 10:35
Show Gist options
  • Save Bouni/19eb4e07c312944790d3e2a69f025b9f to your computer and use it in GitHub Desktop.
Save Bouni/19eb4e07c312944790d3e2a69f025b9f to your computer and use it in GitHub Desktop.
Generate a list of rainbow colors with n entries
def rainbow_color_stops(n=10, end=2 / 3):
rgb = [hls_to_rgb(end * i / (n - 1), 0.5, 1) for i in range(n)]
hex = [f"#{int(255.0*r):02x}{int(255.0*g):02x}{int(255.0*b):02x}" for r, g, b in rgb]
return hex
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment