Due Tuesday 7-Sep, at 10:00pm
hw2.py
file includes test functions to help you test on your own before
you submit to Gradescope. When you run your file, problems will be tested in order. If
you wish to temporarily bypass specific tests (say, because you have not yet completed
some functions), you can comment out individual test function calls at the bottom
of your file in main()
. However, be sure to uncomment and test everything together
before you submit! Ask a CA if you need help with this.
In this case, we've picked a shade of red (RGB: 255, 38, 0) and a shade of green (RGB: 0, 255, 34). The color that is in triadic harmony with this two is the one that completes an isosceles triangle with them on the color wheel, like so:
That third color ends up being a shade of blue (RGB: 36, 0, 255)
colorHarmony(rgb1, rgb2)
, which takes
two integers representing colors at the perimeter of the wheel encoded as just
described and returns the color in the wheel that forms a triadic harmony with
those two colors.colorHarmony(255038000, 255034)
returns 36000255 (note that 36000255 is the same integer value as 036000255, and the
leading zeros is just an output formatting choice that we make when printing the
value)rgbToAngle(rgb)
to find the angle at which the RGB color lies.
angleToRGB(a)
to convert the angle to the RGB color.