Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
color-regex
Advanced tools
Color regex. Easily check the format of any color. Use diverse color helpers available to verify any color.
Readme
Easily check the format of any color. Use diverse color helpers available to verify any color.
npm install color-regex
const Color = require('color-regex');
Color.format('#FF00FF'); // "hex"
Color.format('rgb(255, 100, 50)'); // "rgb"
Color.isRgb('rgb(255, 100, 50)'); // true
Color.isRgba('rgba(255, 100, 50, 0.5)'); // true
Color.array('rgb(255, 100, 50)'); // [ '255', '100', '50' ]
Color.array('hsl(230, 100%, 50%)'); // [ '230', '100%', '50%' ]
Color.array('hsla(320, 100%, 44%, 0.7)', true); // [ '320', '100', '44', '0.7' ]
keyword
Example: "red"
(black,white,red,green,yellow,magenta,cyan,gray,etc)hex
Example: "#FFF000"
rgb
Example: "rgb(255, 255, 255)"
rgba
Example: "rgba(255, 255, 255, 0.3)"
hsl
Example: "hsl(0, 100%, 50%)"
hsla
Example: "hsla(0, 100%, 50%, 0.8)"
hsv
Example: "hsv(330, 93%, 98%)"
hwb
Example: "hwb(0, 100%, 0%)"
const Color = require('color-regex');
//Get color format
console.log(Color.format('blue')); // "keyword"
console.log(Color.format('#FF00FF')); // "hex"
console.log(Color.format('rgb(255, 100, 50)')); // "rgb"
console.log(Color.format('rgba(255, 100, 50, 0.5)')); // "rgba"
console.log(Color.getFormat('hsl(230, 100%, 50%)')); // "hsl"
console.log(Color.getFormat('hsla(320, 100%, 44%, 0.7)')); // "hsla"
console.log(Color.getFormat('hsv(330, 93%, 98%)')); // "hsv"
console.log(Color.getFormat('hwb(0, 100%, 0%)')); // "hwb"
// Check color format
console.log(Color.isKeyword('blue')); // true
console.log(Color.isHex('#FF00FF')); // true
console.log(Color.isRgb('rgb(255, 100, 50)')); // true
console.log(Color.isRgba('rgba(255, 100, 50, 0.5)')); // true
console.log(Color.isHsl('hsl(230, 100%, 50%)')); // true
console.log(Color.isHsla('hsla(320, 100%, 44%, 0.7)')); // true
console.log(Color.isHsv('hsv(330, 93%, 98%)')); // true
console.log(Color.isHwb('hwb(0, 100%, 0%)')); // true
//Clear format and spaces
console.log(Color.clear('rgb(255, 100, 50)')); // "255,100,50"
console.log(Color.clear('rgba(255, 100, 50, 0.3)')); // "255,100,50,0.3"
console.log(Color.clear('hsl(230, 100%, 50%)')); // "230,100%,50%"
console.log(Color.clear('hsla(320, 100%, 44%, 0.7)')); // "320,100%,44%,0.7"
//To array, set true to remove symbols
console.log(Color.array('rgb(255, 100, 50)')); // [ '255', '100', '50' ]
console.log(Color.array('rgba(255, 100, 50, 0.3)', true)); // [ '255', '100', '50', '0.3' ]
console.log(Color.array('hsl(230, 100%, 50%)')); // [ '230', '100%', '50%' ]
console.log(Color.array('hsla(320, 100%, 44%, 0.7)', true)); // [ '320', '100', '44', '0.7' ]
MIT
FAQs
Color regex. Easily check the format of any color. Use diverse color helpers available to verify any color.
The npm package color-regex receives a total of 655 weekly downloads. As such, color-regex popularity was classified as not popular.
We found that color-regex demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
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.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.