UIColor

Swift

extension UIColor
  • Modifies the luminance of a color so it has sufficient contrast with another color. Fully supports dynamic colors.

    @param targetColor The color you ideally want returned if has sufficient contrast. This can be nil, in which case a standard content color will be returned. This can be a dynamic color. @param backgroundColor The color the returned color must have sufficient contrast against. This is typically a background color. This can be a dynamic color. @return A dynamic color with sufficient contrast against backgroundColor in all trait collections. The returned color will be similar to targetColor if possible.

    Declaration

    Swift

    @objc(pspdf_colorFromColor:withSufficientContrastWithBackgroundColor:)
    class func color(from targetColor: UIColor?, withSufficientContrast backgroundColor: UIColor) -> UIColor