stylelint-color-whitelist

1.0.4 • Public • Published

stylelint-color-whitelist

Build Status GitHub license npm version GitHub version GitHub release

Plugin for stylelint to validate color usage defined in whitelist. Plugin transforms all colors to HEX format. So, for declared #fff color, the rgb(255, 255, 255) is also valid. Please note that it ignores the opacity, for example: rgba(255, 255, 255, 0.5), #ffffff80, hsla(0, 0%, 100%, 0.5) are also a valid colors.

Installation

Via NPM:

npm i stylelint-color-whitelist

or Yarn:

yarn add stylelint-color-whitelist

Usage

Add stylelint-color-whitelist to the plugins array. Add color/whitelist rule config to the rules section. Note: Configuration array can get only hex values.

{
  "plugins": ["stylelint-color-whitelist"],

  "rules": {
    "color/whitelist": {
      "color": ["#fff"] // Only hex values
    }
  }
}

Refer to stylelint docs for the detailed info.

Supported formats

Format Example Support
HEX #fff #ffffff #FFF #ffffff88 YES
RGB rgb(255, 255, 255) YES
RGBA rgba(255, 255, 255, 0.5) YES
HSL hsl(0, 0%, 100%) YES
HSLA hsl(0, 0%, 100%, 1) YES
Named red green blue NO

License

stylelint-color-whitelist is MIT licensed.

Package Sidebar

Install

npm i stylelint-color-whitelist

Weekly Downloads

0

Version

1.0.4

License

MIT

Unpacked Size

18.2 kB

Total Files

17

Last publish

Collaborators

  • muzikant