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

    Function labFromCSSString

    • Parses a CSS Lab color string into a LabColor object.

      Supports both comma and space syntax, as well as optional alpha:

      • lab(50%, 43.5, -47.3)
      • lab(50% 43.5 -47.3)
      • lab(50%, 43.5, -47.3, 0.5)
      • lab(50% 43.5 -47.3 / 0.5)

      The function handles:

      • Lightness as a percentage (0-100%)
      • A and B components as numbers (can be negative)
      • 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 Lab color string to parse

      Returns LabColor

      The parsed Lab color object, with lightness normalized to 0-1 range

      If the string format is invalid