HexColor

public struct HexColor : Codable

Represents a color in hexadecimal notation. This type provides compatibility with the Codable protocol for color objects.

  • The raw string value of the hex color code.

    Declaration

    Swift

    public let rawValue: String
  • The UIColor representation of the hex color code.

    Declaration

    Swift

    public let color: UIColor
  • Creates a hex color code from a given UIColor value.

    Declaration

    Swift

    public init(_ color: UIColor)

    Parameters

    color

    The color represented by UIColor.

  • Creates a hex color code from a given string. If the string does not represent a valid color, default is used.

    Declaration

    Swift

    public init(rawValue: String, default: UIColor)

    Parameters

    rawValue

    The raw string representation of the hex color code.

    default

    The fallback color used to create the hex color code when a color cannot be created with rawValue.