A modern JavaScript library that resolves, parses, and converts CSS color strings, including modern Color Module Level 4 and 5 features like color-mix(), color(), advanced color spaces, var(), and calc(). It is useful for turning CSS color and gradient values into computed or specified results, and for converting between formats like HEX, RGB, HSL, LAB, LCH, and OKLCH. It also exposes utilities for validating colors and gradients.
Project status
- Actively maintained, with an upstream push and update on 2026-10-25.
- Updates have been frequent lately, often several days apart and sometimes less than a day apart.
AI summary generated
Recent updates
v7.2.0
v7.2.0 adds color conversion handlers for Display P3, Adobe RGB, ProPhoto RGB, and Rec. 2020, and fixes named-color handling to be case-insensitive. The diff also adds a linear Display P3 converter, changes the mixed-value format token in a way that can break existing callers, and contains an apparent omission in the `convert` aggregate export.
BreakingFeaturesv7.1.9
v7.1.9 updates CSS `color-mix()` resolution, with added coverage for multi-color mixes and additional color spaces and edge cases. The code also changes color parsing precision and the serialization of resolved colors, changes that are not explained by the release notes.
Featuresv7.1.8
v7.1.8 updates the `color-mix()` resolver and adds computed-value handling. The code expands accepted `color-mix()` forms and changes color parsing behavior in several other areas, including an undocumented change to `resolveColorFunc()` handling of non-string input.
Featuresv7.1.7
Release v7.1.7 appears to be largely a documentation and internal refactor update, with many comment and JSDoc blocks rewritten across the codebase. The only clearly code-level change visible in the provided diff is the introduction of additional exported color conversion matrix constants in the matrix module.
v7.1.6
v7.1.6 is primarily a refactor of gradient parsing and related tokenization, plus introduction of calc and generic color token parsing utilities. While the release notes describe several tokenization changes, the actual diff shows deeper reworking of color parsing (including rgb/hsl handling), gradient validation behavior for bad inputs, and multiple internal constant and parsing pathway changes.
Featuresv7.1.5
v7.1.5 updates linting/formatting configuration and reorganizes the internal css-calc-var implementation under utils. The functional behavior change is that gradient stop validation now resolves and serializes calc() length/percentage expressions, producing normalized output.
Featuresv7.1.4
v7.1.4 extends gradient stop parsing to support length-percentage calculations in non-conic gradients, such as typed calc/min/max/clamp expressions. It also updates formatting and linting configuration (braceStyle via Prettier and enforcing curly braces in ESLint). Code changes include a tokenizer-based refactor for splitting and validating gradient color stops.
Featuresv7.1.3
Release v7.1.3 contains only a link to the full changelog, with no enumerated changes in the release notes. The code diff shows behavioral changes around caching, returned value cloning, and color-mix interpolation alpha rounding, plus dependency version bumps.
v7.1.2
v7.1.2 makes a change related to how options are handled during the color conversion to D50. The release notes mention copying options, and the code shows the options object is now cloned instead of being mutated in-place.
v7.1.1
v7.1.1 focuses on copying options instead of mutating the passed Options objects, and improving TypeScript typings across the library. Most of the change set is type-only refactoring, but there are a few runtime behavior changes around cache key generation, CSS custom property resolution, and stricter numeric handling for length unit resolution.
v7.1.0
v7.1.0 is primarily a large internal refactor, reorganizing core logic into new modules (converters, resolvers, gradients, utils, and matrix/transform). It also adds functional improvements such as support for deeply nested color-mix, plus a max length option used to limit processing. The release notes focus on extraction and structural changes, but the code diff shows some additional API and deep-import break risks.
Featuresv7.0.1
v7.0.1 is a patch release that, per the release notes, includes a security fix (GHSA-6g4c-jm42-jc5r). The code changes show additional hardening in color-mix parsing, especially around nested and malformed inputs, plus several dependency version bumps.
Securityv7.0.0
v7.0.0 mainly updates the project tooling setup by removing pnpm usage and adjusting CI to build with npm, and it expands/changes the supported Node.js versions. The code diff also includes multiple internal behavior adjustments in color resolution and calc term sorting, plus a significant Vite build configuration change that can affect the published bundle.
v6.0.7
v6.0.7 adds a new exported helper, sortMathFnTerms, intended to sort math function terms within calc-related expressions. While the release notes mention only the new function, the actual code change also updates the core calc resolution path to use this sorter instead of a simpler minus-handling regex.
Featuresv6.0.6
v6.0.6 focuses on correcting how calc() expressions are parsed and sorted when they appear inside math-like functions such as min(), max(), and clamp(). The implementation also changes serialization details for comma-separated arguments and how calc() is unwrapped and normalized in these contexts.
v6.0.5
v6.0.5 replaces the internal cache implementation based on GenerationalCache with an LRUCache, and increases the configured cache size. The release notes only call out this cache swap, but the code diff also shows an exported cache symbol rename and other build and tooling changes.
Breakingv6.0.4
Release v6.0.4 contains a small internal change to the caching configuration, plus a set of dependency/tooling bumps. The provided release notes do not enumerate any specific functional changes or breaking changes.
v6.0.3
v6.0.3 makes substantial internal changes to caching behavior and upgrades several dependencies. The release notes contain only a changelog link and do not document any of the behavioral or API-relevant changes present in the code diff.
v6.0.2
v6.0.2 focuses on refactoring the internal null handling and reorganizing CSS calc and var resolution logic. It removes the NullObject sentinel type, consolidates css-calc and css-var into a single module, and moves the isColor helper. A new resolver pathway is also introduced to support resolving relative colors more flexibly.
BreakingFeaturesv6.0.1
v6.0.1 does not include any source code changes in the provided diff, but it bumps the dependency @asamuzakjp/generational-cache from 1.0.1 to 2.0.1 and updates the lockfile accordingly. The release notes are effectively empty (only a comparison link), so the dependency change is likely the main content of this release.