Package Exports
- postcss-color-gray
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (postcss-color-gray) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
postcss-color-gray
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 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.