Color

class Color

An object used to store color data using the rgba color space.

  • red

    The red component value of this color. The value of this property is between 0.0 and 1.0.

    Declaration

    var red: Double { get }
  • The green component value of this color. The value of this property is between 0.0 and 1.0.

    Declaration

    var green: Double { get }
  • The blue component value of this color. The value of this property is between 0.0 and 1.0.

    Declaration

    var blue: Double { get }
  • The alpha component value of this color. The value of this property is between 0.0 and 1.0, where 0.0 represents fully transparent and 1.0 represents fully opaque.

    Declaration

    var alpha: Double { get }
  • hex

    The hex string representation of this color. For example the hex string of the color white yields “#FFFFFF00”.

    Declaration

    var hex: String { get }
  • The rgba string representation of this color. For example the rbga string of the color white yields “RGBA(1, 1, 1, 0)”.

    Declaration

    var rgba: String { get }
  • The object’s description

    Declaration

    var description: String { get }
  • Compares two values for equality.

    The equals function is invoked using infix notation as in the following code snippet: lhs == rhs.

    Declaration

    func equals(_ lhs: Color) -> Bool

    Parameters

    lhs

    A value.

    rhs

    Another value.

    Return Value

    true if the lhs and rhs are equal, false otherwise.