# @csstools/postcss-hwb-function

> Use hwb() color functions in CSS

Latest version **5.0.12** (published 2026-09-13) · MIT-0 license · 0 weekly downloads

## Install

```sh
npm install @csstools/postcss-hwb-function
pnpm add @csstools/postcss-hwb-function
yarn add @csstools/postcss-hwb-function
bun add @csstools/postcss-hwb-function
```

## Health

**Score 60/100 (C)** — status: active.

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

Warnings: low downloads; no types.

## Facts

| | |
|---|---|
| Version | 5.0.12 |
| Published | 2026-09-13 |
| First published | 2022-01-22 |
| Weekly downloads | 0 |
| License | MIT-0 |
| TypeScript types | none |
| Module format | ESM |
| Node | >=20.19.0 |
| Dependencies | 5 |
| Unpacked size | 6.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1052 |
| Maintainers | jonathantneal, alaguna, romainmenke |
| Keywords | color, css, design, hwb, notation, postcss, postcss-plugin, syntax |

## Links

- npm: https://www.npmjs.com/package/@csstools/postcss-hwb-function
- Repository: https://github.com/csstools/postcss-plugins
- Homepage: https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-hwb-function#readme
- Issues: https://github.com/csstools/postcss-plugins/issues
- Funding: https://github.com/sponsors/csstools
- npm.io page: https://npm.io/package/@csstools/postcss-hwb-function

## Dependencies (5)

- [@csstools/utilities](https://npm.io/package/@csstools/utilities.md) ^3.0.0
- [@csstools/css-tokenizer](https://npm.io/package/@csstools/css-tokenizer.md) ^4.0.0
- [@csstools/css-color-parser](https://npm.io/package/@csstools/css-color-parser.md) ^4.2.3
- [@csstools/css-parser-algorithms](https://npm.io/package/@csstools/css-parser-algorithms.md) ^4.0.0
- [@csstools/postcss-progressive-custom-properties](https://npm.io/package/@csstools/postcss-progressive-custom-properties.md) ^5.1.3

## Alternatives

- [style-dictionary](https://npm.io/package/style-dictionary.md) — 2.0M weekly downloads
- [postcss-merge-idents](https://npm.io/package/postcss-merge-idents.md) — 1.7M weekly downloads
- [@fontsource/noto-sans](https://npm.io/package/@fontsource/noto-sans.md) — 93.0K weekly downloads
- [uglifycss](https://npm.io/package/uglifycss.md) — 71.6K weekly downloads
- [mat4-interpolate](https://npm.io/package/mat4-interpolate.md) — 23.3K weekly downloads

## Recent versions

- 5.0.12 (latest) — 2026-09-13
- 5.0.11 — 2026-09-06
- 5.0.10 — 2026-08-31
- 5.0.9 — 2026-08-25
- 5.0.8 — 2026-08-15
- 5.0.7 — 2026-07-22
- 5.0.6 — 2026-06-28
- 5.0.5 — 2026-06-14
- 5.0.4 — 2026-05-13
- 5.0.3 — 2026-04-12
- 5.0.2 — 2026-02-21
- 5.0.1 — 2026-01-25
- 5.0.0 — 2026-01-14
- 4.0.12 — 2025-09-21
- 4.0.11 — 2025-08-22
- … 40 more at https://npm.io/package/@csstools/postcss-hwb-function/versions

## README

# PostCSS HWB Function [<img src="https://postcss.github.io/postcss/logo.svg" alt="PostCSS Logo" width="90" height="90" align="right">][PostCSS]

`npm install @csstools/postcss-hwb-function --save-dev`

[PostCSS HWB Function] lets you use the `hwb()` color function in CSS, following [CSS Color Module 4].

```css
a {
	color: hwb(194 0% 0%);
}

b {
	color: hwb(194 0% 0% / .5);
}

/* becomes */

a {
	color: rgb(0, 196, 255);
}

b {
	color: rgba(0, 196, 255, 0.5);
}
```

## Usage

Add [PostCSS HWB Function] to your project:

```bash
npm install postcss @csstools/postcss-hwb-function --save-dev
```

Use it as a [PostCSS] plugin:

```js
const postcss = require('postcss');
const postcssHWBFunction = require('@csstools/postcss-hwb-function');

postcss([
	postcssHWBFunction(/* pluginOptions */)
]).process(YOUR_CSS /*, processOptions */);
```



## Options

### preserve

The `preserve` option determines whether the original notation
is preserved. By default, it is not preserved.

```js
postcssHWBFunction({ preserve: true })
```

```css
a {
	color: hwb(194 0% 0%);
}

b {
	color: hwb(194 0% 0% / .5);
}

/* becomes */

a {
	color: rgb(0, 196, 255);
	color: hwb(194 0% 0%);
}

b {
	color: rgba(0, 196, 255, 0.5);
	color: hwb(194 0% 0% / .5);
}
```

[cli-url]: https://github.com/csstools/postcss-plugins/actions/workflows/test.yml?query=workflow/test
[css-url]: https://cssdb.org/#hwb-function
[discord]: https://discord.gg/bUadyRwkJS
[npm-url]: https://www.npmjs.com/package/@csstools/postcss-hwb-function

[PostCSS]: https://github.com/postcss/postcss
[PostCSS HWB Function]: https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-hwb-function
[CSS Color Module 4]: https://www.w3.org/TR/css-color-4/#the-hwb-notation

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