postcss-better-colors
v2.0.0
Published
PostCSS plugin to transform CSS2 color keywords to a custom palette
Downloads
75
Maintainers
Readme
PostCSS Better Colors
PostCSS plugin to transform CSS2 color keywords to a custom palette
This plugin can transform color keywords such as aqua
, blue
, lime
, etc.
to any other color. Bundled with the
webcolors package, making three beautiful
color palettes available to use in your stylesheets: clrs.cc/mrmrs,
FlatUI and Material -- simply by using standard color names.
Installation
$ npm install postcss-better-colors
Usage
// dependencies
var fs = require('fs');
var postcss = require('postcss');
var palette = require('postcss-better-colors');
// css to be processed
var css = fs.readFileSync('input.css', 'utf8');
// process it
var output = postcss()
.use(palette({
palette: 'material'
})
.process(css)
.css;
Using this input.css
:
body {
color: yellow;
background: linear-gradient(aqua, blue 50%, purple);
}
you will get:
body {
color: #FFEB3B;
background: linear-gradient(#00BCD4, #2196F3 50%, #9C27B0);
}
Options
palette
Specify a webcolors palette name
(mrmrs
, material
or flatui
), or an object mapping of CSS2 color keywords to
color values. By default, uses the mrmrs
color palette.
License
Apache License Version 2.0, January 2004
Copyright
Copyright 2015Zaim Bakar Copyright 2017-2020Sebastian Software GmbH