Lab : Creating Classes
In this lab we will create a class that will represent colors and build a function to combine two colors.
Background
RGB is a way of storing coloring data. R stands for red, G stands for green, and B stands for blue. Each color is given a value from 0 to 255.
You can use this tool to see what different colors are:http://www.rapidtables.com/web/color/RGB_Color.htm
Lab
- Create a class, Color.
- Instantiate a few colors
- Add attributes of r, g, b to the instances
- Create a function, add_color, which takes in two colors and returns a color that is the average of the two reds, greens, and blues