🚨 Shai-Hulud Strikes Again:834 Packages Compromised.Technical Analysis →
Socket
Book a DemoInstallSign in
Socket

postcss-colornorm

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

postcss-colornorm

PostCSS plugin to normalize colors to a specific format

latest
Source
npmnpm
Version
1.0.1
Version published
Maintainers
1
Created
Source

PostCSS Colornorm

npm version GitHub Workflow Status

PostCSS plugin to normalize colors using colornorm to a specific format.

.foo {
  background-color: rgb(255 0 0 / 1);
  border-color: #ff0000ff;
  outline-color: Red;
  color: hsla(0, 100%, 50%, 1);
}
.foo {
  background-color: hsl(0 100% 50%);
  border-color: hsl(0 100% 50%);
  outline-color: hsl(0 100% 50%);
  color: hsl(0 100% 50%);
}

Defaults to hsl, as this is the most intuitive for humans, and supports all browsers back to IE9. This can be changed with a setting.

Usage

Step 1: Install plugin:

npm install --save-dev postcss postcss-colornorm

Step 2: Check you project for existed PostCSS config: postcss.config.js in the project root, "postcss" section in package.json or postcss in bundle config.

If you do not use PostCSS, add it according to official docs and set this plugin in settings.

Step 3: Add the plugin to plugins list:

module.exports = {
  plugins: [
+   require('postcss-colornorm'),
    require('autoprefixer')
  ]
}

Or to choose a different color output format, try:

Valid output color formats can be found on the colornorm docs.

module.exports = {
  plugins: [
+   require('postcss-colornorm')({ output: "hex" }),
    require('autoprefixer')
  ]
}

Keywords

postcss

FAQs

Package last updated on 03 Apr 2021

Did you know?

Socket

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