postcss-google-color
v2.0.1
Published
A PostCSS plugin for easily invoking the colors on the Google Material design color palette
Downloads
162
Maintainers
Readme
PostCSS Google Color
A PostCSS for easily invoking the colors on the Google Material design color palette
Installation
npm install postcss-google-color
Examples
Simple use
/* input */
div { color: google-color(teal) }
/* output */
div { color: #009688 } /* this is shade level 500 (default) */
Select shade level
/* input */
div { color: google-color(teal, 800) }
/* output */
div { color: #00695c }
Get contrasting text color
/* input */
div { background: google-color(red); color: google-color(contrast red) }
/* output */
div { background: #f44336; color: #ffffff }
Usage
Postcss JS API
postcss([require('postcss-google-color')]).process(yourCSS);
Gulp
const gulp = require('gulp');
const postcss = require('gulp-postcss');
const gc = require('postcss-google-color');
gulp.task('css', () => {
gulp.src('path/to/dev/css')
.pipe(postcss([
gc()
]))
.pipe(gulp.dest('path/to/build/css'));
});
Tests
npm test
License
This project is licensed under the MIT License.