colord

A tiny, dependency-free TypeScript library for parsing, converting, and manipulating colors in any format.

Library
npm
v2.10.0
1,887stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
70/100Good
Development Activity80
Maintenance56
Community44
Maturity60
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
83/100Excellent
Architecture88
Code Quality92
Innovation78
Learning Curve75

Colord is a small, zero-dependency TypeScript library for parsing, converting, and manipulating colors. It exposes a single immutable Colord class with a chainable API for reading and transforming color values across HEX, RGB, HSL, and HSV, while an official plugin system adds support for CMYK, LAB, LCH, XYZ, HWB, CSS color names, color mixing, and WCAG accessibility calculations without growing the core bundle beyond roughly 1.8 KB brotli-compressed.

The library targets performance- and bundle-size-sensitive contexts — design tools, CSS-in-JS libraries, and UI component kits — where a general-purpose color library like color or tinycolor2 is heavier than needed. A dedicated benchmark suite, run in CI on every push, tracks conversion throughput and bundle size against those rivals to catch regressions in either.

What You Get

  • Chainable, immutable Colord instances for HEX/RGB/HSL/HSV conversion and manipulation (lighten, darken, saturate, rotate, mix, invert)
  • A roughly 1.8 KB (brotli) zero-dependency core, with official plugins (cmyk, lab, lch, xyz, hwb, names, minify, mix, harmonies, a11y) opted in per byte budget
  • Full TypeScript types shipped in the package itself, including typed exports for every supported color-object shape
  • A WCAG 2.0 accessibility plugin (a11y) for relative luminance, contrast ratio, and isReadable() checks
  • A benchmark suite, enforced in CI, comparing throughput and bundle size against color, tinycolor2, and ac-colors

Common Use Cases

  • Converting user-entered or design-token colors between HEX/RGB/HSL/HSV inside a design tool or theme editor
  • Checking text/background color pairs for WCAG AA/AAA contrast compliance in an accessibility audit
  • Generating color mixes, tints, shades, and tones for a design system’s palette generator
  • Normalizing arbitrary CSS color strings, including CSS Color Level 4 formats, before storing or re-serializing them
  • Minifying generated CSS color values to their shortest valid representation in a build pipeline

Under The Hood

Architecture Colord centers on a single Colord class (src/colord.ts) that stores colors internally as an unrounded RGBA object and exposes conversion/manipulation methods that each return a new instance, keeping the API chainable and immutable. Parsing runs through parse.ts, which holds format-detection tables (parsers.string, parsers.object) populated by the colorModels/ modules (hex, rgb, hsl, hsv, plus plugin-added cmyk/lab/lch/xyz/hwb); extend.ts implements the plugin mechanism itself, patching the Colord prototype and the shared parser tables at runtime while TypeScript declare module blocks in each plugin file add the corresponding typed methods to the class without touching its source. This separation lets official plugins (a11y, mix, names, minify, harmonies, and the extra color spaces) extend both behavior and types while the core stays confined to HEX/RGB/HSL/HSV.

Tech Stack The library is written in strict TypeScript with zero runtime dependencies, built with Rollup into both CJS and ESM outputs (plus per-plugin .d.ts files) and minified with rollup-plugin-terser. Bundle size is enforced with size-limit, which fails the build if the core or any individual plugin crosses its configured byte budget (e.g. 2 KB for the core, 0.5-1.5 KB per plugin). Tests run under Jest with ts-jest; linting uses ESLint with the @typescript-eslint recommended rules plus Prettier integration. GitHub Actions runs two workflows: a standard CI job across Node 18/20/22, and a separate pinned-environment benchmark workflow that compares colord’s throughput and size against color, tinycolor2, and ac-colors on every push and pull request.

Code Quality The test suite spans roughly 1,400 lines across colord.test.ts, plugins.test.ts, delta-e00.test.ts, and parse-complexity.test.ts, covering conversion round-trips across every supported color model, plugin behavior, and edge cases like hue-wrapping at exactly 360 degrees; the README advertises 100% coverage via a Codecov badge tracked in CI. Helper functions carry explicit doc comments explaining non-obvious choices — for example, clampHue()’s comment documents why a two-step modulo is used instead of the canonical single-expression form, to avoid floating-point drift on already-in-range values. Parsing failures are handled by returning null rather than throwing, which the Colord constructor treats as a documented fallback to black rather than a swallowed error. Naming is consistent and the codebase has no untyped any usage in the reviewed core files.

API Design The public surface is small and consistent: one factory function (colord()), one class, and every mutator-style method (lighten, saturate, rotate, alpha, hue) returns either a new immutable instance or, in a getter/setter overload, a plain value — the same pattern repeats across the whole API so there is little to memorize. Plugins extend this surface additively via extend([plugin]) and are opt-in per byte cost, so consumers only pay for the color spaces or utilities they actually import. Every exported color-object shape (RgbColor, HslaColor, etc.) is independently importable for consumers’ own type annotations, and the README documents every plugin with runnable, copy-pasteable examples showing exact input/output values.

Used by 13 apps in this directory

TypeScript
92%
AGPL 3.0

Documenso

Digital Signiture

14,913

Self-hosted, open-source DocuSign alternative with legally binding PDF signatures, multi-party workflows, and a full REST and tRPC API.

View details
93
Repo Health
79
Technical
71
Dependency
Built with
TypeScript92%
Updated today
Go
83%
MIT

Gitea

Devops · Developer Tools · Project Management

57,850

Self-hosted DevOps in a single Go binary — Git hosting, GitHub Actions-compatible CI/CD, and 30+ package registries without any SaaS dependency.

View details
93
Repo Health
79
Technical
64
Dependency
Built with
Go83%
Updated today
Ruby
67%
Other

GitLab

Devops · Developer Tools

24,552

The complete DevOps platform that unifies Git hosting, CI/CD, issue tracking, and security scanning into a single self-hostable application.

View details
87
Repo Health
86
Technical
68
Dependency
Built with
Ruby67%
JavaScript20%
Updated today
TypeScript
83%
Apache 2.0

Grist

Databases · No Code Platforms

11,726

A modern relational spreadsheet that combines Python-powered formulas, drag-and-drop dashboards, and granular access controls in a self-hostable, SQLite-backed data platform.

View details
91
Repo Health
93
Technical
66
Dependency
Built with
TypeScript83%
Python11%
Updated yesterday
Vue
50%
GPL 3.0

IT-Tools

Developer Tools

40,498

A unified collection of 88 web-based developer utilities — from JSON formatting to subnet calculation — all self-hostable, keyboard-searchable, and offline-ready.

View details
60
Repo Health
74
Technical
63
Dependency
Built with
Vue50%
TypeScript48%
Updated 4 days ago
TypeScript
85%
GPL 3.0

Notesnook

Note Taking · File Storage · Security

14,533

End-to-end encrypted, open-source note-taking where your data stays yours — even from the server.

View details
90
Repo Health
84
Technical
60
Dependency
Built with
TypeScript85%
JavaScript12%
Updated 2 days ago
TypeScript
96%
Other

Refly

No Code Platforms · AI Development · Automation

7,502

Build deterministic, versioned agent skills from natural language—run them anywhere from Claude Code to Slack.

View details
64
Repo Health
76
Technical
63
Dependency
Built with
TypeScript96%
Updated 1 months ago
TypeScript
99%
Other

Rowy

Low Code Platforms · Databases

6,840

Manage Firestore data in an Airtable-like spreadsheet UI and build Cloud Functions workflows directly in your browser—on your own GCP project.

View details
45
Repo Health
71
Technical
65
Dependency
Built with
TypeScript99%
Updated 1 years ago
TypeScript
98%
Apache 2.0

Tianji

Analytics · Monitoring

3,086

Replace Google Analytics, UptimeKuma, and Prometheus with one self-hosted platform that tracks websites, monitors uptime, and reports server health.

View details
86
Repo Health
76
Technical
65
Dependency
Built with
TypeScript98%
Updated yesterday

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search