Benchmarks
How Saturon's parsing, conversion, and serialization speed compares to chroma-js, colorjs.io, and culori, and how to reproduce the numbers
Saturon parses colors with a full CSS grammar, which is usually the slow, careful way to build a color library. This page measures what that costs in practice, compares it to other popular color libraries, and explains how to reproduce every number.
Read this before quoting the numbers
Microbenchmarks measure small, isolated operations. They are useful for comparing libraries on the same task, but they don't predict the speed of your application. Treat the results as one input, not a verdict. See Limitations.
Results
Last run: October 17, 2026 on an Intel Core i5-13450HX (13th Gen, ~4.39 GHz), Windows (x64), Node.js 25.2.1.
Each timed run processes 10,000 inputs, so the main column is the time for 10,000 operations. The per-operation column is that time divided by 10,000. The last column compares each library's average with Saturon's class API: lower times are faster. Ratios are computed from the printed averages, so they can differ in the last digit from the summary mitata prints.
Parsing: function-style strings
Parsing: hex strings
Parsing: named colors
Conversion: between color models
Stringify: numbers → CSS string
What is measured
Every library runs the same tasks over the same inputs. Timing is done with mitata.
| Task | What the benchmark does |
|---|---|
| Parsing (function) | Parses a function-style CSS color string, such as lch(...), and reads back numbers from the result |
| Parsing (hex) | Parses a hex color string and reads back numbers from the result |
| Parsing (named) | Parses a named color, such as rebeccapurple, and reads back numbers from the result |
| Conversion | Builds a color from a model name and coordinates, then converts it to a randomly chosen target model |
| Stringify | Builds a color from a model name and coordinates, then serializes it as a CSS string in the same model |
The conversion and stringify tasks include building the color object from its coordinates, because that is part of each library's normal call sequence.
Inputs
- Size: 10,000 inputs per task. The parsing inputs and the conversion/stringify inputs are generated separately.
- Models: random colors from
Color.random(), kept only if the model isrgb,hsl,lab, orlchand every coordinate is a finite number. - Function-style parsing inputs: each random color serialized with
toString({ precision: 1, units: true }), for examplelch(31% 104.7 271.7deg). - Hex parsing inputs: each random color converted with
to("hex-color"), for example#1f7ac4. - Named parsing inputs: color names taken from Saturon's
namedColorstable, for examplerebeccapurple. - Conversion and stringify inputs: a model name and coordinates, in Saturon's coordinate ranges (
rgbchannels 0-255,hslsaturation and lightness 0-100). - Conversion targets: one of
rgb,hsl,lab, orlchper input, chosen with a fixed-seed generator (seed 42). Because targets are independent of the source model, about a quarter of the conversions are to the model the color already has. - Fresh data every run: the random colors are not seeded, so each run uses a different dataset. Only the target sequence is fixed.
API calls used
| Library | Parse | Convert | Stringify |
|---|---|---|---|
| Saturon (class) | Color.from(str).coords | new Color(model, coords).in(target) | new Color(model, coords).toString() |
| Saturon (utils) | parse(str).coords | convert({ model, coords }, target) | format({ model, coords }, model) |
| chroma-js | chroma(str).rgba() | chroma(coords, model)[target]() | chroma(coords, model).css(model) |
| colorjs.io | new Color(str).coords | new Color(space, coords).to(targetSpace) | new Color(space, coords).toString() |
| culori | parse(str) | converter(target)(colorObject) | formatCss(colorObject) |
Limitations
- Libraries don't do the same amount of work. Saturon validates input against the full CSS color grammar, and it accepts syntax that some of these libraries don't parse at all. A faster library that accepts less is not doing the same job. This benchmark parses only function-style
rgb,hsl,lab, andlchstrings, hex colors, and named colors, so Saturon's wider syntax support isn't measured here. For how each library handles the full grammar, see Conformance. - The function-style parsing strings are produced by Saturon's own serializer, and the conversion inputs use Saturon's coordinate ranges without rescaling per library. Some libraries expect other ranges for the same model (for example, culori expects
rgbchannels from 0 to 1), so they receive values outside their usual range. - The benchmark measures time only. It doesn't compare the values each library returns.
- Each timed operation is tiny and repeated many times, which favors code that the JIT compiler optimizes well. Real applications also pay for allocation, bundling, and cold starts. This matters most for named colors, where a single operation takes under a microsecond for the fastest libraries.
- Conversion and stringify use only
rgb,hsl,lab, andlch. Other models, thecolor()function, and newer syntax such ascolor-mix()and relative colors are not measured. - Mixing, interpolation, gamut mapping, contrast, and color difference are not measured. Memory use isn't compared either, although mitata prints heap figures in its raw output. For bundle size, see Tree Shakability & Bundle Size.
- All numbers come from a single Windows machine on one Node.js version.
- Every library here changes over time. These numbers describe the versions listed on the date listed.
Reproduce the results
From the repository root:
pnpm install
pnpm benchThe benchmark lives in apps/benchmarks. It generates its dataset in memory on every run, so no data files are needed, and your numbers will vary slightly from the ones above.
Found a problem?
If you think a benchmark is unfair, uses a library incorrectly, or is out of date, please open an issue or pull request. Benchmarks only help if they're accurate, and corrections from library authors are welcome.