O'Reilly logo

Python 2.6 Graphics Cookbook by Mike Ohlson de Fine

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Newton's grand wheel of color mixing

We make a version of the artist's color wheel which shows how any known color and shade of color can be obtained by judicious mixing of the three primary colors of red, green and blue.

How to do it...

We have made a set of twelve color lists. Each list represents the color that results when you mix colors on either side of it, except for the primary colors of red, green, and blue. The other critical addition to the code is the function rotate(xya, xyb, theta_deg_incr) that is used to rotate the color wedge pattern to a new chosen position around a central point. As some trigonometry is used to do the rotation, the math module needs to be imported at the top of the code. Each segment forms part of the complete ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required