githubEdit

PostCSS Color Functional Notation

NPM Versionarrow-up-right CSS Standard Statusarrow-up-right Build Statusarrow-up-right Support Chatarrow-up-right

PostCSS Color Functional Notationarrow-up-right lets you use space and slash separated color notation in CSS, following the CSS Colorarrow-up-right specification.

:root {
  --firebrick: rgb(178 34 34);
  --firebrick-a50: rgb(70% 13.5% 13.5% / 50%);
  --firebrick-hsl: hsla(0 68% 42%);
  --firebrick-hsl-a50: hsl(0 68% 42% / 50%);
}

/* becomes */

:root {
  --firebrick: rgb(178, 34, 34);
  --firebrick-a50: rgba(178, 34, 34, .5);
  --firebrick-hsl: hsl(0, 68%, 42%);
  --firebrick-hsl-a50: hsla(0, 68%, 42%, .5);
}

Usage

Add PostCSS Color Functional Notationarrow-up-right to your project:

Use PostCSS Color Functional Notationarrow-up-right to process your CSS:

Or use it as a PostCSSarrow-up-right plugin:

PostCSS Color Functional Notationarrow-up-right runs in all Node environments, with special instructions for:

Options

preserve

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

Last updated