Object display color scripts

Just to populate this section of the forum a bit -

3 python scripts I just did to apply a series of display colors to a group of objects

  • Random - but with the ability to choose the color range (say, just
    random reds). You can mix the 3 primary colors to create the complementaries
  • Progressive interpolation from black or white to a primary color (you
    can mix the colors too)
  • Interpolation between two picked colors

Anyway, just thought I’d throw them up here for you to play with…
–Mitch

ColorScripts.zip

5 Likes

Nice, and sticky too!

Hi Mitch
Thanks for sharing this nice scripts.
Ciao Vittorio

Hi,Mitch
I really like these scripts,thanks for sharing.

Mitch, as always, Thanks for sharing your knowledge.

Tried in Rhino 7 and got the following era for the Interpolate Color Script, any idea how to fix?

Oooh, attempted to divide by zero… :flushed: Guess there is a bad assumption somewhere or maybe bad error checking… the script is 10 years old.

Do you have any idea what input you made for the two color choices so I can test?

Edit - I can see one problem if you only choose one object - there I get a divide by zero error. Obviously i didn’t check for only a single object being chosen, that can be fixed. Do you have another situation where this might occur?

Thanks for the quick reply. I think that was the only situation where I was getting that error. I only had one object selected and was randomly assigning the color. Works well fine when multiple are selected.

OK, here is a revised version with special casing for one object, should no longer error out, it will just average the start and end colors chosen. I should probably adapt it for v7 and later and add a transparency channel as well…

InterpolateColorRange.py (1.8 KB)

This particular script was never really designed for that, if you want random, I have some others:

RandomColorSimple.py (406 Bytes)

RandomLightColor3.py (639 Bytes)

RandomSaturatedColor.py (430 Bytes)

1 Like

Thanks Mitch, these are super useful!

Thanks for posting these, Mitch. I’ve used your Interpolate script a bunch over the years.