🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Sign inDemoInstall
Socket

chartjs-color

Package Overview
Dependencies
Maintainers
2
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chartjs-color

Color conversion and manipulation with CSS string support

2.4.1
latest
Source
npm
Version published
Weekly downloads
749K
14.81%
Maintainers
2
Weekly downloads
 
Created

What is chartjs-color?

The chartjs-color npm package is a utility for color manipulation and conversion, designed to work seamlessly with Chart.js. It allows users to create, manipulate, and convert colors in various formats.

What are chartjs-color's main functionalities?

Color Creation

This feature allows you to create color objects from color names, hex codes, or RGB values. The example demonstrates creating a color object from the color name 'red' and converting it to a hex string.

const Color = require('chartjs-color');
const red = Color('red');
console.log(red.hexString()); // Outputs: #ff0000

Color Manipulation

This feature allows you to manipulate colors by lightening, darkening, or adjusting their saturation. The example shows how to lighten the color red by 50%.

const Color = require('chartjs-color');
const red = Color('red');
const lightRed = red.lighten(0.5);
console.log(lightRed.hexString()); // Outputs a lighter shade of red

Color Conversion

This feature allows you to convert colors between different formats such as RGB, HSL, and hex. The example demonstrates converting the color red to RGB and HSL string formats.

const Color = require('chartjs-color');
const red = Color('red');
console.log(red.rgbString()); // Outputs: rgb(255, 0, 0)
console.log(red.hslString()); // Outputs: hsl(0, 100%, 50%)

Other packages similar to chartjs-color

Keywords

color

FAQs

Package last updated on 25 Oct 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