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

    Function oklabFromCSSString

    • Parses a CSS OKLab color string into an OKLabColor object.

      Supports both comma and space syntax, as well as percentage notation for lightness:

      • oklab(0.5, 0.1, -0.2)
      • oklab(0.5 0.1 -0.2)
      • oklab(50%, 0.1, -0.2)
      • oklab(50% 0.1 -0.2)
      • oklab(0.5, 0.1, -0.2, 0.5)
      • oklab(0.5 0.1 -0.2 / 0.5)

      The function handles:

      • Lightness values as either decimals (0-1) or percentages (0-100%)
      • A and B components as signed decimal values
      • Optional alpha value (0-1 or 0-100%)
      • Both comma-separated and space-separated formats
      • Whitespace flexibility according to CSS specifications

      Parameters

      • src: string

        The CSS OKLab color string to parse

      Returns OKLabColor

      The parsed OKLab color object

      If the string format is invalid