Class RGB¶
-
class
colormodel.
RGB
(r, g, b, a=255)¶ An instance is a RGB color value.
Constructor: creates a new RGB value (r,g,b,a).
param r: initial red value Precondition: int between 0 and 255, inclusive.
param g: initial green value Precondition: int between 0 and 255, inclusive.
param b: initial blue value Precondition: int between 0 and 255, inclusive.
param a: initial alpha value (default 255) Precondition: int between 0 and 255, inclusive.
The alpha channel is 255 by default, unless otherwise specified.
Attributes¶
-
RGB.
red
¶ The red channel.
Invariant: Value must be an int between 0 and 255, inclusive.
-
RGB.
green
¶ The green channel.
Invariant: Value must be an int between 0 and 255, inclusive.
-
RGB.
blue
¶ The blue channel.
Invariant: Value must be an int between 0 and 255, inclusive.
-
RGB.
alpha
¶ The alpha channel.
Used for transparency effects (but not in this course).
Invariant: Value must be an int between 0 and 255, inclusive.