A small JavaScript library for parsing and generating CSS color strings. It helps convert color inputs like hex, rgb, hsl, and hwb into structured color values, and generate CSS outputs such as hex, rgb/rgba, keywords, hsl, and hwb strings.
Project status
- Maintenance status: The repo shows ongoing work through 2025 (updates up to 2.1.4 on 2025-11-15), but with no further activity since then (about 9 months as of 2026-08-13), so it currently looks quiet rather than actively driving frequent updates.
- Update cadence (apparent): In 2025 there were several updates clustered relatively closely (2.1.4, 2.1.3, then 2.1.2 in September, 2.1.0 at end of August). After 2025-11-15, the cadence appears to have slowed.
AI summary generated
Recent updates
2.1.4
Release 2.1.4 adds case-insensitive parsing for CSS color strings. The change primarily affects how the library matches color functions (like rgb, hsl, hwb, rgba with percentage alpha) and named keywords (like transparent and named colors).
Features2.1.3
color-string 2.1.3 updates parsing of rgb/rgba() to accept decimal fractions and scientific notation, and adds test coverage for these formats. It also fixes an issue where calling get.rgb() with a named color could produce incorrect results due to shared mutable state.
Features2.1.2
Release 2.1.2 is documented as functionally identical to 2.1.0, with a note that 2.1.1 was compromised. The provided code diff shows no behavioral changes, only a version string update in package.json.
2.1.0
Release 2.1.0 expands CSS color parsing to accept additional “no comma” syntaxes. It adds support for parsing `hwb()` written with whitespace separators, and it relaxes `rgb()`/`rgba()` parsing rules to accept space separated channel formats.
Features2.0.1
Release 2.0.1 updates the TypeScript typings for the color-string API to return null instead of undefined when parsing or converting fails. The published change log documents this typing adjustment, and the code diff shows corresponding updates to the type tests.
Breaking2.0.0
Version 2.0.0 migrates the package to ESM and removes the documented swizzle support. It also introduces a new TypeScript declaration file (index.d.ts) and updates the project tooling and CI matrix to newer Node versions.
BreakingFeatures1.9.0
Release 1.9.0 updates the CSS color string parser to recognize exponential notation (scientific notation) in alpha values for the HSL and HWB color formats. The release notes only mention the new parsing capability.
Features1.8.2
Release 1.8.2 is a patch update for the color-string library. It focuses on fixing how the rgb()/rgba() parser regex handles the optional comma separator in CSS rgb() function arguments.
1.8.1
Release 1.8.1 is a patch update focused on correcting how the library parses the alpha channel when it is provided as a percentage in rgb/rgba strings. The code change updates the alpha parsing logic to use floating-point parsing instead of integer parsing.
1.8.0
Release 1.8.0 is a minor update. It specifically changes how keyword colors are detected by adding start and end anchors to the keyword regex.
Breaking