New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

hexa-color-regex

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hexa-color-regex

regex for the future spec of hexa (hex with alpha)

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

hexa-color-regex

A simple regex to match hexa style colors. hexa is an emerging CSS standard of using hex values to determine color and opacity. Example #fff0 and #ffffff00 would be a white color with zero opacity while #000f and #000000ff would be a black color with full opacity.

Install

npm i hexa-color-regex --save
npm test

Usage

  • [opts] {Object} pass strict: true for strict mode
  • return {RegExp}

Example

  regexCreator().test('#abcd'); // true
  regexCreator().test('color: #f0d6'); // true
  regexCreator().test('#f06d06ff'); // true

  regexCreator({strict: true}).test('#abcd'); // true
  regexCreator({strict: true}).test('color: #abcd'); // false

Contributing

Take care that test cases pass and jscs comes back with no errors. Please try to emulate code style as it exists.

Special Thanks

This code is largely based on @tunnckoCore's hex-color-regex code and adapted for hexa.

License

MIT

Author

Keywords

FAQs

Package last updated on 16 Jul 2015

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