JavaScript
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.editorconfig
.gitattributes
.gitignore
.travis.yml run code linter and coverage reporter only with the latest Node.js Dec 13, 2017
CHANGELOG.md 4.1.0 Dec 19, 2017
LICENSE switch from MIT license to ISC license Dec 13, 2017
README.md switch from MIT license to ISC license Dec 13, 2017
index.js update dependnecies Dec 13, 2017
package-lock.json
package.json
test.js

README.md

postcss-color-gray

CSS Standard Status Build Status Coverage Status

PostCSS plugin to transform gray() function to today's CSS

.foo {
  color: gray(0);
}

.bar {
  color: gray(255, 50%);
}

.baz {
  color: gray;
}

.foo {
  color: rgb(0, 0, 0);
}

.bar {
  color: rgba(255, 255, 255, 0.5);
}

.baz {
  color: gray;
}

Installation

NPM version

Use npm.

npm install postcss-color-gray

API

var postcssColorGray = require('postcss-color-gray');

postcssColorGray()

Return: Function

It converts gray(A) to rgb(A,A,A), and converts gray(A,B) to rgba(A,A,A,B).

var postcss = require('postcss');
var colorGray = require('postcss-color-gray');

postcss()
  .use(colorGray())
  .process('a {color: gray(85); background-color: gray(10%, .25)}')
  .css;
//=> 'a {color: rgb(85, 85, 85); background-color: rgba(26, 26, 26, 0.25)}'

Note that gray() may have a keyword argument to specify a color via "luminance". Current version of postcss-color-gray doesn't support this feature.

License

ISC License © 2017 Shinnosuke Watanabe