Generating a rainbow?

Tobiah toby at rcsreg.com
Thu Apr 8 14:34:21 EDT 2010


> How does that answer your original question?

I was able to do this:

import colorsys

sat = 1
value = 1
length = 1000
for x in range(0, length + 1):
        hue = x / float(length)
        color = list(colorsys.hsv_to_rgb(hue, sat, value))
        for x in range(3):
                color[x] = int(color[x] * 255)
        hexval = ("#%02x%02x%02x" % tuple(color)).upper()
        print "<div style='height: 1; width: 500; background-color: %s'>" 
% hexval


http://tobiah.org/rainbow.html



More information about the Python-list mailing list