@csstools/postcss-hwb-function
TypeScript icon, indicating that this package has built-in type declarations

3.0.15 • Public • Published

PostCSS HWB Function PostCSS Logo

npm version Build Status Discord

Baseline Status CSS Standard Status

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.

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:

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

Use it as a PostCSS plugin:

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

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

PostCSS HWB Function runs in all Node environments, with special instructions for:

Options

preserve

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

postcssHWBFunction({ preserve: true })
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);
}

/@csstools/postcss-hwb-function/

    Package Sidebar

    Install

    npm i @csstools/postcss-hwb-function

    Weekly Downloads

    3,074,717

    Version

    3.0.15

    License

    MIT-0

    Unpacked Size

    10.2 kB

    Total Files

    7

    Last publish

    Collaborators

    • romainmenke
    • alaguna
    • jonathantneal