
Company News
Socket Named Top Sales Organization by RepVue
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.
color-conversion
Advanced tools
##Intention
JavaScript library for color conversion and manipulation with support for CSS color strings.
##Installation
npm install color-conversion
var Color = require("color-conversion")
or
import Color from "color-conversion"
The instance is tranforming RGB to HSL. You should use the 'toHSL' method.
var color = Color("rgb(255, 255, 255)"); //It's can write as var color = Color("255, 255, 255");
color.toHSL(); //[3,0,100]
It's also can transform HSL to RGB(You should use the 'toRGB' method.),such as:
var color = Color("hsl(100, 10%, 25%)"); //It's can write as var color = Color("100, 10%, 25%");
color.toRGB(); //[60,64,57]
Transforming hex to hsl or grb.
var color = Color("ffffff"); //It's can write as var color = Color("#ffffff");
color.toRGB(); //[255,255,255]
color.toHSL(); //[100,0,100]
The library has three methods.That is toRGB,toHSL and toHex.The method will return an array include the transformational color.
FAQs
transform color to any type such 'rgb' or 'hsl'
The npm package color-conversion receives a total of 199 weekly downloads. As such, color-conversion popularity was classified as not popular.
We found that color-conversion 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.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.