Culori is a comprehensive and general-purpose JavaScript color library, currently at stable version 4.0.2. It provides extensive functionality for working with colors across numerous color spaces, including conversions, interpolation, color difference calculations (like CIEDE2000 and DIN99), and blending functions. The library differentiates itself by offering up-to-date support for the color spaces defined in the CSS Color Module Level 4 specification, ensuring compliance with modern web standards. Culori maintains a relatively active release cadence, with recent updates focusing on bug fixes and alignment with CSS specifications, such as precise XYZ to Oklab conversions and correct reference ranges for Lab/Lch modes. Its modular design allows for tree-shaking, optimizing bundle sizes by only including necessary color space definitions and utility functions.
npm install culoriVerified import paths — ran on the pinned version, not inferred.
Demonstrates core functionalities including parsing and converting colors between various color spaces (RGB, Oklch), interpolating between colors, and managing color gamuts by checking and clamping values to ensure displayability within a target space like sRGB. It also shows how to convert a Culori color object to a standard CSS RGB string for output.
Review parsing and serialization logic for any custom color string handling; ensure color component ranges and alpha values conform to the new CSS spec alignments. Adjust existing tests accordingly to reflect these changes.
No direct fix is typically required as this is a spec alignment for accuracy. However, be aware of potential minor numerical differences in Oklab conversions compared to pre-4.0.2 versions, and adjust any snapshot tests or assertions if necessary.
While the error message is improved, ensure that the `mode` color space provided to `toGamut()` (or similar gamut-related functions) is appropriate for the operation and has the expected lightness and chroma components, as defined by the CSS Color Module Level 4 specification.
No direct fix is required, but be aware that sRGB conversions are now more accurate per spec. If you have tests that rely on specific sRGB output values, they might need slight adjustments.
Ensure `culori` is updated to at least v3.1.3, or preferably to the latest v4.x, to leverage critical fixes for bundler compatibility and support for modern JavaScript parsing environments.
Always check the output of parsing or conversion functions. Use a type guard or nullish coalescing (e.g., `parsedColor?.l`) and ensure input color strings or objects are valid before accessing their properties.
Review the input color string for correct CSS color syntax as per the CSS Color Module Level 4 specification. Ensure component ranges (e.g., L, C, H, alpha) and numerical formats are valid and adhere to `culori` v4's stricter parsing rules.
For most use cases, update your import statements to directly import functions from the main `culori` package (e.g., `import { oklch } from 'culori';`). Only use sub-paths if explicitly documented for specific advanced use cases.Consult the `culori` API documentation for the correct named exports in your installed version. Ensure you are using `import { symbol } from 'culori';` for named exports and not `import symbol from 'culori';`.No dependency data recorded yet.