chroma.js
JavaScript library for color conversion, manipulation, and scale generation
Repository Health
Technical Analysis
chroma.js is a small library for all kinds of color operations in the browser and Node.js: converting between color spaces (RGB, HSL, LAB, LCH, HSV, and more), reading colors from CSS strings, named colors, or hex/temperature values, and generating smooth color scales and palettes for maps and charts. It bundles the classic ColorBrewer palettes and X11/CSS named colors out of the box, so data-visualization projects can pull in perceptually reasonable color ramps without hand-picking hex values.
The library exposes a chainable chroma() API for building up color transformations (darken, brighten, saturate, mix, blend) and a chroma.scale() API for interpolating between colors across a domain, commonly used to color choropleth maps, heatmaps, and data-driven charts.
What You Get
- Color parsing and conversion across RGB, HSL, HSV, LAB, LCH, CMYK, and named/hex/CSS color strings
- A chainable color-manipulation API (darken, brighten, saturate, desaturate, alpha, mix, blend)
- A
chroma.scale()API for building continuous or discretized color scales/gradients between multiple colors - Built-in ColorBrewer palettes and X11/CSS named colors ready to use as scale inputs
- Color-distance and contrast utilities for accessibility and perceptual-difference checks
Common Use Cases
- Coloring choropleth maps and heatmaps by interpolating a value across a color scale
- Generating data-visualization color palettes (sequential, diverging, categorical) from ColorBrewer presets
- Programmatically lightening, darkening, or blending brand colors for hover/active UI states
- Converting user-supplied or design-token colors between formats (hex, RGB, HSL) for theming systems
Under The Hood
Architecture: The chroma() factory in Color.js normalizes any input format through src/io/input.js, which dispatches to per-space parsers under src/io/ (hex, css, named, cmyk, hsl, hsv, lab, lch, gl, num), converting everything to an internal RGB representation that manipulation methods (darken, saturate, mix) and src/generator/src/interpolator scale logic operate on before re-serializing back out through the same io modules on demand. Tech Stack: Written in modern JavaScript (ESM, ships both index.js ESM and dist/chroma.cjs CJS/UMD builds via Rollup), with a handful of legacy .coffee files still present in the io layer (delta-e, distance) alongside newer plain-JS modules, built and tested with pnpm and Vitest. Code Quality: A large test/ directory (50+ files) covers each color-space converter and the scale/interpolation logic individually, giving good regression coverage for a library where subtle color-math bugs are easy to introduce; the codebase shows its age in a mix of coding styles (CoffeeScript remnants alongside ES modules) reflecting over a decade of incremental maintenance. API Design: The chainable chroma(color).method().method() style and the single chroma.scale() entry point for gradients keep the common cases terse, though the breadth of supported color-space names and options makes the full API surface non-trivial to memorize without consulting docs.
Used by 25 apps in this directory
OpenReplay
Analytics
Self-hosted session replay and product analytics suite that lets you see exactly what users do on your web app — without sending data to third parties.
Plane
Collaboration · Productivity · Project Management
Open-source project management platform to replace Jira, Linear, and ClickUp — with built-in cycles, real-time collaborative docs, and full self-hosting.
Plasmic
CMS · Design Tools · Low Code Platforms
The open-source visual builder that lets teams design React apps and websites with drag-and-drop while integrating seamlessly with your codebase.
Redash
Analytics · Data Engineering
Redash lets anyone connect to 35+ SQL and NoSQL data sources, write a query in the browser, and turn the result into a shared dashboard — no separate BI suite required.
Rill
Analytics · Data Engineering
The fastest BI tool for humans and agents — define metrics, models, and dashboards as code and query them instantly on ClickHouse or DuckDB.
solidtime
Invoicing Finance · Productivity
Modern open-source time tracker for freelancers and agencies with invoicing, multi-org support, and Toggl/Clockify migration built in.
Uptime Kuma
Monitoring
Self-hosted monitoring for every service you run — 23 monitor types, 95 notification channels, live dashboards, and public status pages with no vendor lock-in.