- class itom.rgba(r, g, b, alpha=255)¶
Color value object (RGB + optional alpha channel).
Creates a new color value from red, green, blue and optional alpha. If any value > 255 is passed as argument, its modulo with
256is taken instead.
rgbaobject implements many methods of the number protocol, such that it becomes possible to add, subtract, multiply… two colors. In most cases these operations are executed for each color component independently.
For a gray value set all colors to the same value.
- toGray() float ¶
returns the gray value from the color (alpha is not considered)
The returned gray value is a float value and calculated by
0.299 * r + 0.587 * g + 0.114 * b