Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

colorguard-processor

Package Overview
Dependencies
Maintainers
0
Versions
149
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

colorguard-processor

PostCSS processor to keep a watchful eye on your css colors

  • 2.0.98
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
699
increased by49.04%
Maintainers
0
Weekly downloads
 
Created
Source

Colorguard Processor

Every CSS project starts out with good intentions, but inevitably, one too many people eye-dropper colors into nooks and crannies that you never knew existed. CSS Colorguard Upgraded helps you maintain the color set that you want, and warns you when colors you've added are too similar to ones that already exist. Naturally, it's all configurable to your tastes.

How it works

Colorguard uses the CIEDE2000 algorithm to determine the similarity of each of the colors in your CSS file. This algorithm is quite complex, but is used in the broadcasting community as the best approximation of human ability to discern differences in color. RGB on the other hand, is pretty bad at representing differences in color purely based on the numerical difference of the hex values.

API

CJS

const { processor } = require('colorguard-processor');
processor.process(css, [options]).then((result) => {});

ESM

import { processor } from 'colorguard-processor';
processor.process(css, [options]).then((result) => {});

options

ignore

Type: array

Specify colors that you would like to ignore completely. Use with caution.

[['black', '#010101', 'rgba(0,0,0,1)']];

whitelist

Type: array

Pass an array of color pairs to ignore:

[['#000000', 'rgba(0,0,0,1)']];

threshold

Type: number Default: 3

0 through 100. Lower values are more precise; the default is 3 but that's mostly personal opinion.

allowEquivalentNotation

Type: boolean Default: false

By default, colorguard will complain if identical colors are represented with different notations. For example, #000, #000000, rgba(0, 0, 0, 0), and black. If you want to permit these equivalent notations, set this option to true.

Install

npm install colorguard-processor
yarn add colorguard-processor

Thanks

  • @SlexAxton - Created css-colorguard

Keywords

FAQs

Package last updated on 12 Nov 2024

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

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc