WCAGContext

public enum WCAGContext

How the colors being compared are being used

  • Normal text, less than 18 pts (Bold less than 14 pts)

    Declaration

    Swift

    case normalText
  • Large text, 18 pts or greater (Bold 14 pts or greater)

    Declaration

    Swift

    case largeText
  • Graphical object or user interface component

    Declaration

    Swift

    case uiComponent
  • minimum required contrast to meet the WCAG 2.0 AA standard for this context type

    Declaration

    Swift

    public var thresholdAA: CGFloat { get }
  • minimum required contrast to meet the WCAG 2.0 AAA standard for this context type

    Warning

    Returns .nan for uiComponent because there is no AAA standard defined for UI components.

    Declaration

    Swift

    public var thresholdAAA: CGFloat { get }
  • Returns the threshold level for the specified context and level

    Declaration

    Swift

    public func threshold(for level: WCAGLevel) -> CGFloat

    Parameters

    level

    AA or AAA

    Return Value

    the minimum contrast ratio required to meet the specified level for this context type