UIColor

class UIColor : NSObject, NSSecureCoding, NSCopying

Collection of all UIColor Extensions.

Subspec: Extensions/UIColorExtension

  • Returns an image of the color.

    Declaration

    Swift

    public var image: UIImage { get }
  • Initialize and return a UIColor object that corresponds to the given hex string

    Declaration

    Swift

    public convenience init(hexString: String)

    Parameters

    hexString

    6 digits color hex string

  • Darkens the receiver color by blending it with black color using given weight.

    Declaration

    Swift

    public func darken(by weight: CGFloat) -> UIColor

    Parameters

    weight

    Proportional weight that should be given to blend color, specified as value from 0.0 to 1.0.

    Return Value

    Darkened color.

  • Brightens the receiver color by blending it with white color using given weight.

    Declaration

    Swift

    public func brighten(by weight: CGFloat) -> UIColor

    Parameters

    weight

    Proportional weight that should be given to blend color, specified as value from 0.0 to 1.0.

    Return Value

    Brightened color.

  • Fades the current color to the target color.

    Declaration

    Swift

    public func fadeColor(targetColor: UIColor, percent: CGFloat) -> UIColor

    Parameters

    targetColor

    Target color to transition to.

    percent

    Percent of the fade.

    Return Value

    The faded color.

  • Blend the receiver with specified color using given weight.

    Declaration

    Swift

    public func blend(with blendColor: UIColor, weight: CGFloat) -> UIColor

    Parameters

    blendColor

    Color to blend with.

    weight

    Proportional weight that should be given to blend color, specified as value from 0.0 to 1.0.

    Return Value

    Blended color.