Colord

A tiny yet powerful JavaScript tool for high-performance color manipulations and conversions

Analysis

Is valid CSS value?
Yes
Format
HEX
Hue (0–359)
348 deg
Brightness
33% (Dark)
Luminance
16%
Contrast on white
4.98:1

Conversion

HEX
#dc143c
RGB
rgb(220, 20, 60)
HSL
hsl(348, 83%, 47%)
HWB
hwb(348 8% 14%)
CMYK
device-cmyk(0% 91% 73% 14%)
LCH
lch(47.88% 79.63 26.46)
CSS keyword
crimson

Getting Started

npm i colord
import { colord } from "colord";

colord("#ff0000").grayscale().toRgbString();
colord("rgb(192, 192, 192)").isLight();
colord("hsl(0, 50%, 50%)").darken(0.25).toHex();

Why Colord?

📦 Small

Just 1.7 KB gzipped (3x+ lighter than color and tinycolor2)

💨 Dependency-free

Fast CI and no vulnerability risks

🚀 Fast

3x+ faster than color and tinycolor2

😍 Simple

Chainable API and familiar patterns

🛡 Bulletproof

Written in strict TypeScript and has 100% test coverage

🗂 Typed

Ships with types included

🏗 Extendable

Built-in plugin system to add new functionality

📚 CSS-compliant

Strictly follows CSS Color Level specifications

👫 Works everywhere

Supports all browsers and Node.js

💪 Immutable

No need to worry about data mutations