weasel API - v0.8.0
    Preparing search index...

    Function parseColor

    • Parse a CSS color string into [r, g, b, a] with 0..1 components.

      Supported forms:

      • Hex: #rgb, #rgba, #rrggbb, #rrggbbaa (any case)
      • rgb() / rgba() with integer, float, or percent R/G/B; number or percent alpha; commas or modern space-separated R G B / A syntax
      • hsl() / hsla() with hue as a unitless number (deg) or with deg, rad, grad, turn units; saturation/lightness as percent (or unitless in the modern syntax); same alpha rules and separator rules as rgb()
      • The 148 CSS named colors plus transparent

      Not supported: oklch(), lab(), color(), currentColor, system colors. Throws on anything unrecognized.

      Results are cached by input-string identity. Callers MUST treat the returned tuple as read-only — mutation would corrupt the cache.

      Parameters

      • input: string

      Returns [number, number, number, number]