You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

chartjs-color-string

Package Overview
Dependencies
Maintainers
2
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chartjs-color-string

Parser and generator for CSS color strings

0.6.0
latest
Source
npmnpm
Version published
Weekly downloads
759K
-0.07%
Maintainers
2
Weekly downloads
 
Created

What is chartjs-color-string?

The chartjs-color-string npm package is a utility library for parsing and generating color strings. It is commonly used in conjunction with Chart.js to handle color inputs and outputs in various formats such as hex, RGB, and HSL.

What are chartjs-color-string's main functionalities?

Parsing Color Strings

This feature allows you to parse a color string into its RGB components. In this example, the RGB string 'rgb(255, 0, 0)' is parsed into an array [255, 0, 0].

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

Generating Color Strings

This feature allows you to generate a color string from an array of RGB values. In this example, the RGB array [255, 0, 0] is converted into the hex string '#ff0000'.

const colorString = require('chartjs-color-string');
const hex = colorString.to.hex([255, 0, 0]);
console.log(hex); // '#ff0000'

Parsing HSL Strings

This feature allows you to parse an HSL color string into its components. In this example, the HSL string 'hsl(120, 100%, 50%)' is parsed into an array [120, 100, 50].

const colorString = require('chartjs-color-string');
const hsl = colorString.get.hsl('hsl(120, 100%, 50%)');
console.log(hsl); // [120, 100, 50]

Generating HSL Strings

This feature allows you to generate an HSL color string from an array of HSL values. In this example, the HSL array [120, 100, 50] is converted into the HSL string 'hsl(120, 100%, 50%)'.

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

Other packages similar to chartjs-color-string

Keywords

color

FAQs

Package last updated on 07 Mar 2019

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