Color String Parser
JSON →color-parse is a fast and compact JavaScript library designed for parsing a wide array of CSS-compatible color strings into a structured object representation. It supports numerous formats including color keywords (e.g., 'red'), hex codes (`#RGB`, `#RRGGBB`, with optional alpha), functional notations like `rgb()`, `rgba()`, `hsl()`, `hsla()`, `hwb()`, `cmyk()`, and modern color spaces such as `xyz()`, `luv()`, `lab()`, `lch()`, `oklab()`, `oklch()`, and the generic `color()` function. Additionally, it can parse custom formats like `R:10 G:20 B:30` and array-like inputs. The library currently ships as version 2.0.2 and is actively maintained. It emphasizes performance and minimal bundle size, differentiating itself from alternatives by focusing solely on parsing without performing color space conversions, which helps keep its footprint small compared to libraries like `parse-color` or `color-string` that offer extensive conversion APIs.
Traffic · last 30 days ↓44% vs prev 7d
top countries 🇺🇸 United States · 🇩🇪 Germany · 🇸🇬 Singapore · 🇨🇦 Canada · 🇫🇷 France