UIColor

class UIColor : NSObject, NSSecureCoding, NSCopying

This allows us to deal with HSB colors, and detect grayscale and clear

  • This just allows us to get an HSB color from a standard UIColor. From here: https://stackoverflow.com/a/30713456/879365

    Declaration

    Swift

    var hsba: (h: CGFloat, s: CGFloat, b: CGFloat, a: CGFloat) { get }

    Return Value

    A tuple, containing the HSBA color.

  • Declaration

    Swift

    var isGrayscale: Bool { get }

    Return Value

    true, if the color is grayscale (or black or white).

  • Declaration

    Swift

    var isClear: Bool { get }

    Return Value

    true, if the color is clear.

  • Declaration

    Swift

    var whiteLevel: CGFloat { get }

    Return Value

    the white level of the color.