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

    Function getOptimalColorForContrast

    • Finds an optimal color for contrast using either APCA or WCAG 2.1 method This is a convenience function that accepts various color formats

      Parameters

      • foreground: string | Color

        The foreground color (text color) in any supported format

      • background: string | Color

        The background color in any supported format

      • targetContrast: number

        The desired contrast value

      • method: OptimalContrastMethod = 'APCA'

        The contrast calculation method to use (default: 'APCA')

      Returns RGBColor

      A new color with optimal contrast while preserving hue and saturation