npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

what-color-is-it

v0.0.1

Published

A simple package that converts colors

Downloads

1

Readme

what-color-is-it

Features

  • 🎨 Convert between HEX, RGB, HSL, and HSV color formats
  • 🏷️ Support for 100+ color labels with standard color values
  • ✅ Type-safe with full TypeScript support
  • 🛡️ Robust error handling and validation
  • 🪶 Lightweight with minimal dependencies
  • 📦 ESM and CommonJS support

Installation

# Using npm
npm install what-color-is-it

# Using yarn
yarn add what-color-is-it

# Using pnpm
pnpm add what-color-is-it

Usage

Basic Import

// ESM
import {
  convertHexToRGB,
  convertRGBToHex,
  convertLabelToHEX,
} from "what-color-is-it";

// CommonJS
const {
  convertHexToRGB,
  convertRGBToHex,
  convertLabelToHEX,
} = require("what-color-is-it");

Converting Colors

HEX Conversions

// Convert HEX to RGB
convertHexToRGB("#FF5733"); // Returns: "rgb(255, 87, 51)"

// Convert HEX to HSL
convertHexToHSL("#FF5733"); // Returns: "hsl(14, 100%, 60%)"

// Convert HEX to HSV
convertHexToHSV("#FF5733"); // Returns: "hsv(14, 80%, 100%)"

RGB Conversions

// Convert RGB to HEX
convertRGBToHex("rgb(255, 87, 51)"); // Returns: "#FF5733"
convertRGBToHex("255, 87, 51"); // Also works with this format

// Convert RGB to HSL
convertRGBToHSL("rgb(255, 87, 51)"); // Returns: "hsl(14, 100%, 60%)"

// Convert RGB to HSV
convertRGBToHSV("rgb(255, 87, 51)"); // Returns: "hsv(14, 80%, 100%)"

HSL Conversions

// Convert HSL to HEX
convertHSLToHex("hsl(14, 100%, 60%)"); // Returns: "#FF5733"
convertHSLToHex("14, 100%, 60%"); // Also works with this format

// Convert HSL to RGB
convertHSLToRGB("hsl(14, 100%, 60%)"); // Returns: "rgb(255, 87, 51)"

// Convert HSL to HSV
convertHSLToHSV("hsl(14, 100%, 60%)"); // Returns: "hsv(14, 80%, 100%)"

HSV Conversions

// Convert HSV to HEX
convertHSVToHex("hsv(14, 80%, 100%)"); // Returns: "#FF5733"
convertHSVToHex("14, 80%, 100%"); // Also works with this format

// Convert HSV to RGB
convertHSVToRGB("hsv(14, 80%, 100%)"); // Returns: "rgb(255, 87, 51)"

// Convert HSV to HSL
convertHSVToHSL("hsv(14, 80%, 100%)"); // Returns: "hsl(14, 100%, 60%)"

Using Color Labels

Convert from any of the 100+ built-in color labels to different formats:

// Convert color label to HEX
convertLabelToHEX("red"); // Returns: "#FF0000"
convertLabelToHEX("turquoise"); // Returns: "#40E0D0"

// Convert color label to RGB
convertLabelToRGB("forest green"); // Returns: "rgb(34, 139, 34)"

// Convert color label to HSL
convertLabelToHSL("lavender"); // Returns: "hsl(240, 67%, 94%)"

// Convert color label to HSV
convertLabelToHSV("gold"); // Returns: "hsv(51, 100%, 84%)"

TypeScript Support

The library includes full TypeScript support with type definitions for all functions and a comprehensive ColorLabel type for named colors:

import { ColorLabel } from "what-color-is-it";

// ColorLabel is a union type of all supported color names
function useColor(color: ColorLabel) {
  // Type-safe color handling
}

useColor("emerald"); // Valid
useColor("not-a-color"); // TypeScript error

Error Handling

All conversion functions include robust error handling:

// Invalid HEX format
convertHexToRGB("not-a-hex-color");
// Returns: "Invalid hex color. Make sure to include the # symbol"

// Invalid RGB values
convertRGBToHex("rgb(300, 0, 0)");
// Returns: "Invalid RGB values. Each component must be 0-255"

License

MIT © ezzeldin