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.
Verified import paths — ran on the pinned version, not inferred.
The package exports a single function as its default, so named imports are incorrect. For CommonJS, use `const parseCSSColor = require('csscolorparser');`.
Demonstrates importing the default `parseCSSColor` function and using it to parse various valid and invalid CSS color strings, logging the RGBA array or null.
Breaking-change detection hasn't run for this library yet.
CVE tracking and dependency tree are planned for a later release.