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

Package detail

postcss-color-gray

postcss4.7mISC5.0.0

Use the gray() color function in CSS

postcss, css, postcss-plugin, gray, color, lab, transform, function, csswg, w3c, specification

readme

PostCSS Gray PostCSS

NPM Version CSS Standard Status Build Status Support Chat

PostCSS Gray lets you use the gray() color function in CSS, following the CSSWG Specification.

body {
  background-color: gray(100);
  color: gray(0 / 90%);
}

/* becomes */

body {
  background-color: rgb(255,255,255);
  color: rgba(0,0,0,.9);
}

Usage

Add PostCSS Gray to your project:

npm install postcss-color-gray --save-dev

Use PostCSS Gray to process your CSS:

import postcssGray from 'postcss-color-gray';

postcssGray.process(YOUR_CSS /*, processOptions, pluginOptions */);

Or use it as a PostCSS plugin:

import postcss from 'postcss';
import postcssGray from 'postcss-color-gray';

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

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

Node Webpack Create React App Gulp Grunt

Options

preserve

The preserve option determines whether the original gray() function should be preserved or replaced. By default, the gray() function is replaced.

By setting preserve to true, the original gray() function is preserved.

postcssGray({ preserve: true });
body {
  background-color: gray(100);
  color: gray(0 / 90%);
}

/* becomes */

body {
  background-color: gray(100);
  background-color: rgb(255,255,255);
  color: gray(0 / 90%);
  color: rgba(0,0,0,.9);
}

changelog

Changes to PostCSS Gray

5.0.0 (July 26, 2018)

4.1.0 - December 19, 2017

  • Changed: relicense (MITISC)
  • Updated dependencies

4.0.0 - May 15, 2017

  • Added: compatibility with PostCSS v6
  • Updated dependencies

3.0.1 - November 28, 2016

  • Bump color dependency version (@KenanY)

3.0.0 - September 8, 2015

  • Added: compatibility with PostCSS v5
  • Removed: compatibility with PostCSS v4

2.0.0 - January 26, 2015

  • Added: compatibility with PostCSS v4
  • Removed: compatibility with PostCSS v3

1.1.0 - November 25, 2014

  • Changed: Enhanced exceptions

1.0.0 - November 1, 2014

  • Initial release