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

3.0.9 • Public • Published

PostCSS Color Mix Function PostCSS Logo

npm install @csstools/postcss-color-mix-function --save-dev

PostCSS Color Mix Function lets you use the color-mix() function following the CSS Color 5 Specification.

.purple_plum {
	color: color-mix(in lch, purple 50%, plum 50%);
}

/* becomes */

.purple_plum {
	color: rgb(175, 92, 174);
}

[!NOTE] We can not dynamically resolve var() arguments in color-mix(), only static values will work.

Usage

Add PostCSS Color Mix Function to your project:

npm install postcss @csstools/postcss-color-mix-function --save-dev

Use it as a PostCSS plugin:

const postcss = require('postcss');
const postcssColorMixFunction = require('@csstools/postcss-color-mix-function');

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

Options

preserve

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

postcssColorMixFunction({ preserve: true })
.purple_plum {
	color: color-mix(in lch, purple 50%, plum 50%);
}

/* becomes */

.purple_plum {
	color: rgb(175, 92, 174);
	color: color-mix(in lch, purple 50%, plum 50%);
}

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
3.0.9211,271latest

Version History

VersionDownloads (Last 7 Days)Published
3.0.9211,271
3.0.8252,799
3.0.7112,173
3.0.689,865
3.0.59,463
3.0.45,372
3.0.37,770
3.0.263,003
3.0.11,166
3.0.01,664
2.0.19238,230
2.0.1816
2.0.174,739
2.0.1656,766
2.0.151
2.0.149,203
2.0.1312,529
2.0.124,318
2.0.11469
2.0.1015,670
2.0.927,021
2.0.82,777
2.0.749,243
2.0.63,236
2.0.51,877
2.0.41,077
2.0.33,955
2.0.21,160
2.0.110,001
2.0.02
1.0.3134,114
1.0.22,768
1.0.17,514
1.0.09,331

Package Sidebar

Install

npm i @csstools/postcss-color-mix-function

Weekly Downloads

1,054,172

Version

3.0.9

License

MIT-0

Unpacked Size

9.04 kB

Total Files

7

Last publish

Collaborators

  • jonathantneal
  • alaguna
  • romainmenke