Created
January 31, 2015 15:11
-
-
Save dimazest/2717e2c2730fc44bf450 to your computer and use it in GitHub Desktop.
random, yet matching colors
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
from colorsys import rgb_to_hls, hls_to_rgb | |
import random | |
def colors(): | |
r, g, b = 1, 0, 0 | |
h, l, s = rgb_to_hls(r, g, b) | |
while True: | |
h += 30./360 | |
if h > 1.0: | |
h -= 1 | |
l = random.random() | |
s = random.random() | |
yield hls_to_rgb(h, s, l) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment