@tremendous/help
    Preparing search index...

    Function isWhiteTextReadable

    • Whether white text on background meets the given WCAG contrast ratio (defaults to 4.5:1, the AA threshold for normal text). Use to choose a readable text color over a brand-colored surface — white when it passes, a dark color otherwise. Returns false for an invalid color.

      Parameters

      • background: string

        The CSS color string of the surface.

      • OptionalminRatio: number = 4.5

        Minimum white-on-background contrast ratio (default 4.5).

      Returns boolean

      Whether white text clears the ratio.

      isWhiteTextReadable("#97a1a1"); // false (~2.64:1)