@csstools/postcss-color-mix-variadic-function-arguments
Mix any number of colors with the color-mix function in CSS
Last updated 3 months ago by romainmenke .
MIT-0 · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @csstools/postcss-color-mix-variadic-function-arguments 
SYNC missed versions from official npm registry.

PostCSS Color Mix Variadic Function Arguments PostCSS Logo

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

PostCSS Color Mix Variadic Function Arguments lets you use the color-mix() function with any number of arguments following the CSS Color 5 Specification.

.red {
	color: color-mix(in srgb, red);
}

.grey {
	color: color-mix(in srgb, red, lime, blue);
}

/* becomes */

.red {
	color: rgb(255, 0, 0);
}

.grey {
	color: rgb(85, 85, 85);
}

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

Usage

Add PostCSS Color Mix Variadic Function Arguments to your project:

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

Use it as a PostCSS plugin:

const postcss = require('postcss');
const postcssColorMixVariadicFunctionArguments = require('@csstools/postcss-color-mix-variadic-function-arguments');

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

Options

preserve

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

postcssColorMixVariadicFunctionArguments({ preserve: true })
.red {
	color: color-mix(in srgb, red);
}

.grey {
	color: color-mix(in srgb, red, lime, blue);
}

/* becomes */

.red {
	color: rgb(255, 0, 0);
	color: color-mix(in srgb, red);
}

.grey {
	color: rgb(85, 85, 85);
	color: color-mix(in srgb, red, lime, blue);
}

Current Tags

  • 2.0.2                                ...           latest (2 months ago)

6 Versions

  • 2.0.2                                ...           2 months ago
  • 2.0.1                                ...           3 months ago
  • 2.0.0                                ...           3 months ago
  • 1.0.2                                ...           7 months ago
  • 1.0.1                                ...           8 months ago
  • 1.0.0                                ...           10 months ago
Downloads
Today 0
This Week 0
This Month 1
Last Day 0
Last Week 1
Last Month 0
Dev Dependencies (0)
None
Dependents (1)

Copyright 2013 - present © cnpmjs.org | Home |