Socket
Socket
Sign inDemoInstall

colors-regex

Package Overview
Dependencies
1
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    colors-regex

Regular expressions for rgb, rgba, hex, hexa, hsl & hsla colors


Version published
Weekly downloads
3.1K
decreased by-2.27%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

colors-regex

Standard - JavaScript Style Guide standard-readme compliant Build Status

Regular expressions for rgb, rgba, hex, hexa, hsl & hsla colors

Table of Contents

Install

$ npm install --save colors-regex
$ yarn add colors-regex

Usage

const assert = require('assert')
const colorsRegex = require('colors-regex');

assert(colorRegex.hex.strict.test('#000000')) // Success
assert(colorRegex.hex.strict.test('#2')) // Failure

API

The module exports a single object with the different color types as properties. Each color type has a strict & global regex.

const colorRegex = require('./index')
console.log(colorRegex)
// { hex:
//    { strict: ...
//      global: ...},
//   hexa:
//    { strict: ...,
//      global: ... },
//   rgb:
//    { strict: ...,
//      global: ... },
//   rgba:
//    { strict: ...,
//      global: ... },
//   hsl:
//    { strict: ...,
//      global: ...},
//   hsla:
//    { strict: ...,
//      global: ... } }

Contribute

Contributions are welcome. Please open up an issue or create PR if you would like to help out.

Note: If editing the README, please conform to the standard-readme specification.

License

Created with ♥ by Tiaan. Licensed under the MIT License.

Keywords

FAQs

Last updated on 16 Dec 2016

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