werkbank
    Preparing search index...

    Function textColor

    • Calculates an accessible text color based on a background color using APCA contrast. It attempts to use the requested Hue and Chroma in OKLCH space. If the colored text does not meet the minimum contrast threshold, it falls back to Black or White.

      Parameters

      • backgroundColor: string

        The hex, rgb, or named string of the background.

      • options: TextColorOptions = {}

        Optional target hue (0-360) and chroma (0-0.3+) for the text color.

      Returns string

      The hex string of the accessible text color.