Skip to content

sebastian-software/postcss-better-colors

Repository files navigation

PostCSS Better Colors
Sponsored by Version Downloads Build Status Unix Build Status Windows Dependencies

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

Logo of Sebastian Software GmbH, Mainz, Germany

Copyright 2015
Zaim Bakar

Copyright 2017-2020
Sebastian Software GmbH

About

PostCSS Plugin for using better standard colors than the default web palette.

Resources

License

Stars

Watchers

Forks

Packages

No packages published