# @csstools/convert-colors

> Convert colors between RGB, HEX, HSL, HWB, LAB, LCH, and more

Latest version **2.0.1** (published 2026-02-21) · CC0-1.0 license · 0 weekly downloads

## Install

```sh
npm install @csstools/convert-colors
pnpm add @csstools/convert-colors
yarn add @csstools/convert-colors
bun add @csstools/convert-colors
```

## Health

**Score 55/100 (C)** — status: stable.

Positive: esm support; no vulnerabilities; high maintenance score.

Warnings: low downloads; no types.

## Facts

| | |
|---|---|
| Version | 2.0.1 |
| Published | 2026-02-21 |
| First published | 2018-01-22 |
| Weekly downloads | 0 |
| License | CC0-1.0 |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Node | >=6.0.0 |
| Dependencies | 0 |
| Unpacked size | 204.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Jonathan Neal |
| Maintainers | jonathantneal, alaguna, romainmenke |
| Keywords | colors, contrast, conversions, converting, converts, hex, hsl, hsv, hwb, lab, lch, rgb, xyz, blue, green, red, blackness, hue, lightness, saturation, whiteness, cie, ciede2000, contrast, wcag |

## Links

- npm: https://www.npmjs.com/package/@csstools/convert-colors
- Repository: https://github.com/csstools/convert-colors
- Homepage: https://github.com/csstools/convert-colors#readme
- Issues: https://github.com/csstools/convert-colors/issues
- npm.io page: https://npm.io/package/@csstools/convert-colors

## Alternatives

- [memory-cache](https://npm.io/package/memory-cache.md) — 795.0K weekly downloads
- [@httptoolkit/proxy-agent](https://npm.io/package/@httptoolkit/proxy-agent.md) — 11.2K weekly downloads
- [express-cache-controller](https://npm.io/package/express-cache-controller.md) — 5.3K weekly downloads
- [http-cache-middleware](https://npm.io/package/http-cache-middleware.md) — 4.5K weekly downloads
- [cache2](https://npm.io/package/cache2.md) — 1.5K weekly downloads

## Recent versions

- 2.0.1 (latest) — 2026-02-21
- 2.0.0 — 2019-01-29
- 1.4.0 — 2018-01-28
- 1.3.0 — 2018-01-26
- 1.1.0 — 2018-01-22
- 1.0.0 — 2018-01-22

## README

# Convert Colors [<img src="https://cdn.worldvectorlogo.com/logos/nodejs-icon.svg" alt="Convert Colors" width="90" height="90" align="right">][Convert Colors]

[![NPM Version][npm-img]][npm-url]

[Convert Colors] converts colors between RGB, HEX, HSL, HWB, LAB, LCH, and more.

```js
import convert from '@csstools/convert-colors';

convert.rgb2hsl(100, 100, 100); // [ 0, 0, 100 ]
convert.rgb2hwb(100, 100, 100); // [ 0, 100, 0 ]

convert.hsl2rgb(0, 0, 100); // [ 0, 100, 0 ]
convert.hsl2hwb(0, 0, 100); // [ 0, 100, 0 ]

convert.hwb2rgb(0, 100, 0); // [ 0, 0, 100 ]
convert.hwb2hsl(0, 100, 0); // [ 0, 0, 100 ]

convert.rgb2hue(0, 0, 100); // 240

convert.rgb2contrast([100, 100, 100], [0, 0, 0]); // 21
convert.rgb2ciede2000([100, 100, 100], [0, 0, 0]); // 100
```

## Usage

Add [Convert Colors] to your build tool:

```bash
npm install @csstools/convert-colors --save-dev
```

## Features

Conversions work by taking arguments that represents a color in one color space
and returning an array of that same color in another color space.

[Documentation](https://csstools.github.io/convert-colors/)

[npm-url]: https://www.npmjs.com/package/@csstools/convert-colors
[npm-img]: https://img.shields.io/npm/v/@csstools/convert-colors.svg

[Convert Colors]: https://github.com/csstools/convert-colors

---
_Source: https://npm.io/package/@csstools/convert-colors · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
