CSS Color Parser
JSON →csscolorparser is a lightweight JavaScript utility designed to parse CSS color strings into an RGBA array. It was initially released in 2012 and has not seen updates since version 1.0.3, published approximately 9 years ago. The package directly exports a single function, `parseCSSColor`, which takes a string (e.g., 'rgba(255, 128, 12, 0.5)', '#fff', 'slateblue') and returns a four-element array `[R, G, B, A]` where R, G, B are integers (0-255) and A is a float (0-1), or `null` for invalid input. Its primary differentiator is its simplicity and lack of dependencies, but its age means it only supports older CSS Color Module Level 3/4 formats and lacks support for newer specifications like HWB, LAB, LCH, Oklab, Oklch, or the `color()` function. It operates as a CommonJS module with interop for ESM.
Traffic · last 30 days ↑50% vs prev 7d
top countries 🇸🇬 Singapore · 🇺🇸 United States · 🇨🇦 Canada · 🇫🇷 France · 🇩🇪 Germany