UIColor

extension UIColor
  • PowerUpSwift: Initializes a UIColor based from the hex value.

    Example

    let color = UIColor(hex: "#FFFFFF")
    

    Declaration

    Swift

    public convenience init(hex: String)

    Parameters

    hex

    The hex string value similar to HTML.

  • PowerUpSwift: Initializes a UIColor based from the rgb/a value similar to HTML.

    Declaration

    Swift

    public convenience init(r: CGFloat, g: CGFloat, b: CGFloat, a: CGFloat? = 1.0)

    Parameters

    r

    Red

    g

    Green

    b

    Blue

    a

    Alpha that defaults to 1.0 if not provided. ### Example swift let color = UIColor(r: 255, g: 255, b: 255) let anotherColor = UIColor(r: 0, g: 0, b: 0, a: 0.5)