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

hsla-regex

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

hsla-regex

Regex for matching HSLA colors.

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2.3M
decreased by-4.36%
Maintainers
1
Weekly downloads
 
Created

What is hsla-regex?

The hsla-regex npm package provides a regular expression for matching HSLA (Hue, Saturation, Lightness, Alpha) color strings. This can be useful for validating, parsing, or extracting HSLA color values from strings.

What are hsla-regex's main functionalities?

Match HSLA color strings

This feature allows you to match HSLA color strings within a larger string. The code sample demonstrates how to use the hsla-regex package to find an HSLA color string in a CSS declaration.

const hslaRegex = require('hsla-regex');
const str = 'background-color: hsla(120, 100%, 50%, 0.3);';
const match = str.match(hslaRegex());
console.log(match); // ['hsla(120, 100%, 50%, 0.3)']

Validate HSLA color strings

This feature allows you to validate whether a given string is a valid HSLA color string. The code sample shows how to use the hsla-regex package to check if a string is a valid HSLA color.

const hslaRegex = require('hsla-regex');
const isValidHsla = (str) => hslaRegex().test(str);
console.log(isValidHsla('hsla(120, 100%, 50%, 0.3)')); // true
console.log(isValidHsla('rgb(255, 0, 0)')); // false

Other packages similar to hsla-regex

Keywords

FAQs

Package last updated on 30 Jan 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