Socket
Socket
Sign inDemoInstall

postcss-colormin

Package Overview
Dependencies
15
Maintainers
8
Versions
66
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

postcss-colormin

Minify colors in your CSS files with PostCSS.


Version published
Maintainers
8
Weekly downloads
10,262,276
decreased by-8.34%

Weekly downloads

Package description

What is postcss-colormin?

The postcss-colormin package is a PostCSS plugin designed to optimize color values within your CSS. It reduces the size of color values and converts them into more efficient formats when possible, contributing to smaller CSS file sizes and potentially faster load times for web pages.

What are postcss-colormin's main functionalities?

Minifying color values

This feature takes a CSS string with color values and uses the colormin plugin to minimize the color values. For example, it can convert '#ff0000' to 'red', which is shorter.

"const postcss = require('postcss');
const colormin = require('postcss-colormin');

postcss([colormin()]).process('a { color: #ff0000; }').then(result => {
  console.log(result.css); // Output: 'a { color: red; }'
});"

Converting RGBA to hex when possible

This feature optimizes RGBA color values to their hex or named color equivalent when the alpha value is 1, thus reducing the size of the CSS.

"const postcss = require('postcss');
const colormin = require('postcss-colormin');

postcss([colormin()]).process('a { background-color: rgba(255, 0, 0, 1); }').then(result => {
  console.log(result.css); // Output: 'a { background-color: red; }'
});"

Other packages similar to postcss-colormin

Readme

Source

postcss-colormin

Minify colors in your CSS files with PostCSS.

Install

With npm do:

npm install postcss-colormin --save

Example

var postcss = require('postcss')
var colormin = require('postcss-colormin');

var css = 'h1 {color: rgba(255, 0, 0, 1)}';
console.log(postcss(colormin()).process(css).css);

// => 'h1 {color:red}'

For more examples see the tests.

Usage

See the PostCSS documentation for examples for your environment.

Contributors

See CONTRIBUTORS.md.

License

MIT © Ben Briggs

Keywords

FAQs

Last updated on 01 Mar 2022

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc