🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

color-string

Package Overview
Dependencies
Maintainers
1
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

color-string

Parser and generator for CSS color strings

2.0.1
latest
Source
npm
Version published
Weekly downloads
26M
-7.11%
Maintainers
1
Weekly downloads
 
Created

What is color-string?

The color-string npm package is a library for parsing and generating CSS color strings. It allows users to work with various color formats, convert between them, and manipulate color values.

What are color-string's main functionalities?

Parsing Color Strings

This feature allows you to parse CSS color strings into an array of RGBA values.

const colorString = require('color-string');
const color = colorString.get.rgb('rgba(255, 204, 0, 0.7)');
console.log(color); // [255, 204, 0, 0.7]

Generating Color Strings

This feature enables you to generate CSS color strings from RGB(A) or HSL(A) values.

const colorString = require('color-string');
const rgbString = colorString.to.rgb([255, 204, 0]);
console.log(rgbString); // 'rgb(255, 204, 0)'

Converting Color Models

This feature allows you to convert color values between different color models, such as RGB to HSL.

const colorString = require('color-string');
const hslString = colorString.to.hsl([255, 204, 0]);
console.log(hslString); // 'hsl(45, 100%, 50%)'

Other packages similar to color-string

Keywords

color

FAQs

Package last updated on 14 Feb 2025

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