stylelint-color-no-non-variables
This is a stylelint plugin to require usage of variables instead of color literals.
Installation
npm i stylelint-color-no-non-variables
Usage
Add the plugin into your .stylelintrc alongside the rule usage.
{
"plugins": ["stylelint-color-no-non-variables"],
"rules": {
"dczajkowski/color-no-non-variables": true
}
}
For this config the following applies:
.a {
background-color: var(--background-color);
border: 1px solid var(--border-color);
}
.b {
background-color: black;
color: #fff;
border-top-color: rgb(10, 20, 30);
border-left-color: rgba(10, 20, 30, 40%);
border-right-color: hsl(10, 20%, 30%);
border-bottom-color: hsla(10, 20%, 30%, 40%);
background: color(#fff shade(10%));
border: 1px solid #000;
}
License
This plugin is an open-sourced software licensed under the MIT license.