Color
An RGB color.
class Color
Constructors
RGB
constructor(
red: Int,
green: Int,
blue: Int,
)
Constructs a new Color from 8-bit RGB values.
The individual channels range from
0to255.
RGBA
constructor(
red: Int,
green: Int,
blue: Int,
alpha: Int,
)
Constructs a new Color from 8-bit RGBA values.
The individual channels range from
0to255.
Packed Integer
constructor(_ rgba: Int)
Constructs a new Color from a composed integer value. This constructor is typically used
together with a hexadecimal integer literal in the form of 0xAARRGGBB.
Properties
red
red: Int { get }
The value of the red channel.
green
green: Int { get }
The value of the green channel.
blue
blue: Int { get }
The value of the blue channel.
alpha
alpha: Int { get }
The value of the alpha channel.
Methods
opacity
opacity(_ value: Float) -> (Color)
Returns a new Color with RGB channel values and the given opacity.
The opacity value must be in the range
0.0to1.0.
to_string
to_string() -> (String)
Returns a string representation of the color.