UIColor

extension UIColor
  • Check the color is it’s dark. This is useful when you need to choose the black or white text color for some background color.

    Note

    let textColor: UIColor = backgroundColor.isDark ? .white : .black

    Declaration

    Swift

    public var isDark: Bool { get }

    Return Value

    true if the color is dark.

UIImage with color

  • Create an image 1x1 with the color.

    Declaration

    Swift

    public var image: UIImage { get }

Debug

  • Create a random transparent color.

    Declaration

    Swift

    static var debug: UIColor { get }