class Color

A Color object is used to represent a color for drawing on a Canvas. Color objects are immutable.

Support for alpha values in colors is platform-dependent. On platforms with no alpha support, alpha values always read as 1.0. Even if colors with alpha are supported by a platform, alpha values may be ignored by some operations.

Constructor functions

rgb(red, green, blue, alpha = 1.0)
Returns a Color instance constructed from components in the RGB color space. Each component should be in the range 0.0 to 1.0.

Properties

red
green
blue
Read-only. Components in the RGB color space, in the range 0.0 to 1.0.

alpha
Read-only. Alpha (opacity) value of the color. 0.0 is fully transparent, 1.0 is fully opaque.

rgb
Read-only. Components of the color as a tuple (red, green, blue).

rgba
Read-only. Components of the color as a tuple (red, green, blue, alpha).