Generating a rainbow?

Chris Colbert sccolbert at gmail.com
Fri Apr 9 00:28:27 CEST 2010


On Thu, Apr 8, 2010 at 2:34 PM, Tobiah <toby at rcsreg.com> wrote:
>> 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
> --
> http://mail.python.org/mailman/listinfo/python-list
>

I see. It appears I misunderstood the question.

The link doesn't work in Chrome btw.



More information about the Python-list mailing list