Color
open class Color : Hashable, Equatable
Represents a color. This class implements Equatable.
-
Initializes a new instance of the Color class with a default color.
Declaration
Swift
public convenience init()Return Value
The newly initialized Color object.
-
Initializes a new instance of the Color class with the specified RGB values.
Declaration
Swift
public convenience init(red: Double, green: Double, blue: Double)Parameters
redThe red value.
greenThe green value.
blueThe blue value.
Return Value
The newly initialized Color object.
-
Initializes a new instance of the Color class with the specified RGB values and alpha value.
Declaration
Swift
public init(alpha: Double, red: Double, green: Double, blue: Double)Parameters
alphaThe alpha value.
redThe red value.
greenThe green value.
blueThe blue value.
Return Value
The newly initialized Color object.
-
Initializes a new instance of the Color class with the specified RGB values and alpha value given as bytes.
Declaration
Swift
open class func fromBytes(_ alpha: UInt8, red: UInt8, green: UInt8, blue: UInt8) -> ColorParameters
alphaA 8-bit unsigned integer value that represents the alpha value.
redA 8-bit unsigned integer value that represents the red value.
greenA 8-bit unsigned integer value that represents the green value.
blueA 8-bit unsigned integer value that represents the blue value.
Return Value
The newly initialized Color object.
-
Initializes a new instance of the Color class with the specified RGB values.
Declaration
Swift
open class func fromRGB(_ red: UInt8, green: UInt8, blue: UInt8) -> ColorParameters
redA 8-bit unsigned integer value that represents the red value.
greenA 8-bit unsigned integer value that represents the green value.
blueA 8-bit unsigned integer value that represents the blue value.
Return Value
The newly initialized Color object.
-
Initializes a new instance of the Color class from the specified string.
Declaration
Swift
public class func fromString(_ s: String) -> ColorParameters
sThe string to parse.
Return Value
The newly initialized Color object.
-
Serializes this Color instance to a string.
Declaration
Swift
open func toString() -> StringReturn Value
A string that represents this Color.
-
Checks if this Color is empty.
Declaration
Swift
open func isEmpty() -> BoolReturn Value
True if the Color is empty; otherwise false.
-
Declaration
Swift
public func hash(into hasher: inout Hasher) -
Initializes the red value of this Color.
Declaration
Swift
open var red: Double -
Initializes the green value of this Color.
Declaration
Swift
open var green: Double -
Initializes the blue value of this Color.
Declaration
Swift
open var blue: Double -
Initializes the alpha value of this Color.
Declaration
Swift
open var alpha: Double
Color Class Reference