PostCSS plugin to transform gray() to today's CSS
JavaScript
Latest commit f5d5734 Nov 28, 2016 @MoOx MoOx 3.0.1
Permalink
Failed to load latest commit information.
.editorconfig init Oct 29, 2014
.eslintrc init Oct 29, 2014
.gitattributes init Oct 29, 2014
.gitignore init Oct 29, 2014
.jscs.json init Oct 29, 2014
.travis.yml Upgrade to PostCSS 5.x, fix specs Sep 7, 2015
CHANGELOG.md 3.0.1 Nov 28, 2016
LICENSE init Oct 29, 2014
README.md tweak readme Nov 1, 2014
appveyor.yml Upgrade to PostCSS 5.x, fix specs Sep 7, 2015
index.js Upgrade to PostCSS 5.x, fix specs Sep 7, 2015
package.json 3.0.1 Nov 28, 2016
test.js Upgrade to PostCSS 5.x, fix specs Sep 7, 2015

README.md

postcss-color-gray

Build Status Build status Coverage Status Dependency Status devDependency 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

Copyright (c) 2014 Shinnosuke Watanabe

Licensed under the MIT License.