@dragonspark/chroma-kit
    Preparing search index...

    Function contrastMichelson

    • Calculates the Michelson contrast between two XYZ colors based on their luminance values.

      The Michelson contrast is primarily used to measure the contrast ratio between two light sources or between patterns with equivalent areas of light and dark. It was originally developed for measuring the contrast of interference fringes in optics experiments.

      Formula: (Lmax - Lmin) / (Lmax + Lmin)

      Key characteristics:

      • Produces values in the range [0, 1], where 0 indicates no contrast and 1 indicates maximum contrast
      • Symmetric with respect to the two luminance values
      • Commonly used in vision science and display technology
      • Most appropriate when both stimuli occupy similar areas in the visual field

      Limitations:

      • Not ideal for stimuli with very different areas
      • Less sensitive to small differences in high luminance values
      • Cannot distinguish between different absolute luminance levels with the same ratio

      Parameters

      • color1: XYZColor

        The first color represented in the XYZ color space.

      • color2: XYZColor

        The second color represented in the XYZ color space.

      Returns number

      The Michelson contrast ratio, ranging from 0 to 1, where higher values indicate greater contrast.

      • Used when both colors have zero luminance