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

    Function p3FromCSSString

    • Parses a CSS P3 color string into a P3Color object.

      Supports the CSS Color Module Level 4 color() function format:

      • color(display-p3 0.5 0.5 0.5)
      • color(display-p3 0.5 0.5 0.5 / 0.5)

      The parsing process:

      1. Assumes the string starts with "color(display-p3" (verified by the function)
      2. Determines the delimiter style (comma or space)
      3. Parses the r component
      4. Parses the g component
      5. Parses the b component
      6. Parses the optional alpha component
      7. Verifies proper closing of the string

      Parameters

      • src: string

        The CSS P3 color string to parse

      Returns P3Color

      The parsed P3 color object

      If the string format is invalid