Socket
Socket
Sign inDemoInstall

stylelint-color-no-non-variables

Package Overview
Dependencies
340
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    stylelint-color-no-non-variables

A stylelint to enforce usage of css variables in place of color literals.


Version published
Maintainers
1
Install size
1.32 MB
Created

Readme

Source

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:

/* This is allowed */

.a {
  background-color: var(--background-color);
  border: 1px solid var(--border-color);
}

/* This is not allowed */

.b {
  background-color: black; /* Color name */
  color: #fff; /* Hex code */
  border-top-color: rgb(10, 20, 30); /* Usage of the rgb function */
  border-left-color: rgba(10, 20, 30, 40%); /* Usage of the rgba function */
  border-right-color: hsl(10, 20%, 30%); /* Usage of the hsl function */
  border-bottom-color: hsla(10, 20%, 30%, 40%); /* Usage of the hsla function */
  background: color(#fff shade(10%));  /* Usage of postcss color function */
  border: 1px solid #000; /* Hex code (or any other of the above) embedded into a complex rule */
}

License

This plugin is an open-sourced software licensed under the MIT license.

FAQs

Last updated on 17 Jul 2019

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc