Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

postcss-relative-opacity

postcss12.5kMIT0.1.0TypeScript support: included

PostCSS plugin to add opacity to any colors with Relative Color Syntax

postcss, css, postcss-plugin, oklch, opacity

readme

PostCSS Relative Opacity

PostCSS plugin to add opacity to any colors with Relative Color Syntax.

Upcoming CSS Colors 5 allows to change any color including adding opacity. But Firefox still doesn’t support this syntax. This tool partially polyfill thi syntax via color-mix().

.notice {
  background: oklch(from var(--accent-color) l c h / 30%);
}

will be processed to:

.notice {
  background: color-mix(in srgb, var(--accent-color) 30%, transparent);
}

Made in Evil Martians, product consulting for developer tools.


Docs

Read full docs here.