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

    Function lchFromCSSString

    • Parses a CSS LCh color string into a LChColor object.

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

      • lch(50%, 75, 270)
      • lch(50% 75 270)
      • lch(50%, 75, 270, 0.5)
      • lch(50% 75 270 / 0.5)

      The function handles:

      • Lightness as a percentage (0-100%)
      • Chroma as a number (no specific range, but typically 0-230 for RGB gamut)
      • Hue as an angle in degrees (0-360)
      • 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 LCh color string to parse

      Returns LChColor

      The parsed LCh color object

      If the string format is invalid