g3-toolkit API Reference
    Preparing search index...

    Function contrastRatioOrNull

    • WCAG contrast ratio between two hex colors (1..21); null if either color is not plain hex (e.g. rgba() strings are skipped, not failed).

      Named for the null, because @g3-toolkit/core exports a contrastRatio that returns a plain number and the two used to share that name across the two packages. They are not interchangeable: this one is what createTheme needs, since a theme may legitimately carry an rgba() value that has to be SKIPPED rather than scored. Swapping in core's would silently score such a pair instead of skipping it, so the difference is behavioral and the names say so.

      Parameters

      • a: string
      • b: string

      Returns number | null