color
Immutable JavaScript color conversion and manipulation with CSS string support
Repository Health
Technical Analysis
color is a small, dependency-light JavaScript library for parsing, converting, and manipulating colors across virtually every color space in common use — RGB, HSL, HSV, CMYK, HWB, LAB, LCH, HCG, ANSI16/256, and Apple RGB. It accepts CSS color strings, named colors, and plain object/array inputs, and returns an immutable Color instance that supports chained transformations.
Built on top of color-convert and color-string, it exposes manipulation helpers like lighten, darken, saturate, rotate, mix, and grayscale, plus WCAG-relevant utilities such as luminosity, contrast, and isLight/isDark for accessible UI decisions. Its small footprint and broad format coverage make it a common dependency inside design tools, CLI colorizers, and CSS preprocessing utilities.
What You Get
- Parsing of CSS strings, named colors, hex, and object/array inputs across 11 color models
- Chainable, immutable manipulation methods (lighten, darken, saturate, rotate, mix, grayscale)
- WCAG luminosity and contrast-ratio calculations for accessibility-aware color decisions
- Getters for individual channels and conversion to hex, rgb number, or CSS string output
- TypeScript type definitions shipped alongside the package
Common Use Cases
- Generating accessible text/background color pairs by computing WCAG contrast ratios
- Building design-tool or theming utilities that need to lighten/darken a base brand color
- CLI tools that colorize terminal output using ANSI16/256 color model conversions
- CSS-in-JS or preprocessing tooling that manipulates colors programmatically at build time
Under The Hood
Architecture - The library is a thin, functional wrapper (index.js) around two sibling packages — color-convert for cross-model numeric conversion and color-string for parsing/serializing CSS-syntax strings — exposing a single Color factory that stores an internal {model, color, valpha} triple and lazily converts between spaces on demand. Tech Stack - Modern ESM-only package ("type": "module") targeting Node >=18, written in plain JavaScript with shipped .d.ts type definitions, zero runtime dependencies beyond color-convert/color-string. Code Quality - Tests run via mocha with xo (ESLint preset) for linting and tsd for type-definition testing, giving both runtime and type-level coverage; the test directory covers each color model and manipulation method. API Design - The chainable, immutable API (Color('#7743CE').alpha(0.5).lighten(0.5).hsl().string()) is a well-known ergonomic pattern that keeps call sites terse while avoiding mutation surprises, though the breadth of supported color models does add some API surface to learn.
Used by 26 apps in this directory
Nextcloud Server
Collaboration · File Storage
Your own private cloud: self-hosted file sync, collaboration, and communication with no vendor lock-in.
SigNoz
Analytics · Monitoring
Self-host your entire observability stack — logs, metrics, traces, and LLM monitoring — in one OpenTelemetry-native platform, without the Datadog bill.
Hexclave
Authentication · Developer Tools
The open-source user infrastructure platform — authentication, teams, payments, emails, analytics, and more on a single unified user model.
Supabase
Authentication · Databases · Developer Tools
The open-source Postgres development platform that replaces Firebase with authentication, real-time APIs, edge functions, storage, and vector embeddings — all built on PostgreSQL.
Tabby
AI Code Assistants
Self-hosted AI coding assistant — run GitHub Copilot-grade code completion on your own hardware with no cloud dependency.
Teable
Databases · No Code Platforms
A no-code PostgreSQL database with spreadsheet UX, real-time collaboration, and native AI agents — built for teams that outgrow Airtable.
Uptrace
Devops · Monitoring
Unified open-source APM that collects OpenTelemetry traces, metrics, and logs into a single self-hosted platform backed by ClickHouse.
Wire
Collaboration · Team Chat · Video Conferencing
Open source end-to-end encrypted messaging for teams and enterprises — self-host for complete control over your communications and data.