Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

stylelint-color-no-non-variables

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

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.

  • 0.0.2
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
8
decreased by-77.78%
Maintainers
1
Weekly downloads
 
Created
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

Package last updated on 17 Jul 2019

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc