Stylelint Color Control is a stylelint rule to control color usage in CSS.
Add stylelint and Stylelint Color Control to your project.
npm install stylelint stylelint-color-control --save-dev
Add Stylelint Color Control to your stylelint configuration.
{
"plugins": [
"stylelint-color-control"
],
"rules": {
"csstools/stylelint-color-control": "always" || "never" || "ignore"
}
}
If the first option is "always"
or true
, then Stylelint Color Control requires all
nodes to be linted, and the following patterns are not considered violations:
.example {}
While the following patterns are considered violations:
.example {}
If the first option is "never"
or false
, then Stylelint Color Control requires all
nodes to be linted, and the following patterns are not considered
violations:
.example {}
While the following patterns are considered violations:
.example {}
If the first option is "ignore"
or null
, then Stylelint Color Control does nothing.