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

    Function hwbFromCSSString

    • Parses a CSS HWB color string into an HWBColor object.

      Supports both comma and space syntax:

      • hwb(120, 30%, 40%)
      • hwb(120 30% 40%)
      • hwb(120, 30%, 40%, 0.5)
      • hwb(120 30% 40% / 0.5)

      The function handles:

      • Hue values in degrees (0-360, normalized if outside this range)
      • Whiteness and blackness as percentages (0-100%)
      • 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 HWB color string to parse

      Returns HWBColor

      The parsed HWB color object

      If the string format is invalid