Stylelint plugin to add rule no-indistinguishable-colors
Switch branches/tags
Nothing to show
Clone or download
Latest commit 2f95213 Jul 19, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
__tests__ Negative tests Jul 19, 2018
lib #1 Add disable option Jun 23, 2018
.editorconfig Add eslint Jun 13, 2018
.eslintrc Add tests Jun 14, 2018
.gitignore Add tests snapshots Jun 23, 2018
.travis.yml Fix test job Jun 23, 2018
README.md Add more tests Jul 19, 2018
package.json 1.2.1 Jul 19, 2018
yarn.lock Add tests Jun 14, 2018

README.md

stylelint-no-indistinguishable-colors

Travis NPM Version

Stylelint plugin that disallows colors that are suspiciously close to being identical, using css-colorguard.

Installation

npm install --save-dev stylelint stylelint-no-indistinguishable-colors

Usage

Update your Stylelint config with following rules:

{
  "plugins": [
    "stylelint-no-indistinguishable-colors"
  ],
  "rules": {
    "plugin/stylelint-no-indistinguishable-colors": true
  }
}

Options

Boolean, or an array of options, where the first element is true, and the second is an options object.

Boolean option

true: Enables the plugin. Defaults to Colorguard's threshold of 3.

false: Disables the plugin.

Optional secondary options

Corresponds to Colorguard options object.

ignore: Array ['#colorA', '#colorB']

Hex color codes that you would like to ignore completely.

threshold: Number

Number can be between 0 and 100. The default value is 3.

The lower the threshold the more similar the colors have to be to trigger a violation. The higher the threshold, the more violations you will get.

whitelist: Array [['#colorA', '#colorB'], ['#colorC', '#colorD']]

An array of color pairs to ignore.

allowEquivalentNotation: Boolean

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.