stylelint-gamut is a Stylelint plugin that helps you to work with different color spaces.
color-no-out-gamut-range: Throw warning if color goes out of sRGB color space and is not wrapped in@media (color-gamut: p3) {}or@media (color-gamut: rec2020) {}.
- node version ≥ 12.0.0
- Stylelint version ≥ 14.0.0.
- If you haven't, install Stylelint:
npm install stylelint stylelint-config-standard --save-dev
- Install
stylelint-gamut:
npm install stylelint-gamut --save-dev
- Add
stylelint-gamutto your Stylelint configpluginsarray, then add rules you need to the rules list. All rules fromstylelint-gamutneed to be namespaced withgamut.
{
"plugins": ["stylelint-gamut"],
"rules": {
"gamut/color-no-out-gamut-range": true
}
}It is already used by the creator of PostCSS Andrey Sitnik.
Read more about color spaces in css:
