Color
An RGB color.
class Color
Constructors
(red: Int, green: Int, blue: Int)
Constructs a new Color
from 8-bit RGB values.
The individual channels range from
0
to255
.
(red: Int, green: Int, blue: Int, alpha: Int)
Constructs a new Color
from 8-bit RGBA values.
The individual channels range from
0
to255
.
(_ value: 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: Int (get)
The value of the red channel.
green: Int (get)
The value of the green channel.
blue: Int (get)
The value of the blue channel.
alpha: Int (get)
The value of the alpha channel.
Methods
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.0
to1.0
.
to_string() -> (String)
Returns a string representation of the color.