Function contrast

  • The contrast function calculates the contrast ratio between two colors. Implementation of http://www.w3.org/TR/WCAG20/#contrast-ratiodef

    Returns

    • The contrast ratio between two colors in the format of "X.X:1".

    Throws

    • Throws an error if either of the color arguments is invalid.

    Parameters

    • color1: Color

      The first color to compare.

    • color2: Color

      The second color to compare.

    Returns string

Generated using TypeDoc