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 🙏

© 2025 – Pkg Stats / Ryan Hefner

colvert

v2.3.0

Published

A comprehensive color conversion and manipulation package for JavaScript/TypeScript

Downloads

243

Readme

Colvert 🎨

A comprehensive color conversion and manipulation package for JavaScript/TypeScript

Version Documentation License: MIT TypeScript

Features

  • 🔄 Convert between different color formats (RGB, HEX, HSL, CMYK)
  • 🎨 Generate random colors
  • ✨ Manipulate colors (lighten, darken, saturate, desaturate)
  • 🌈 Generate color schemes
  • 💪 TypeScript support
  • 🚀 Zero dependencies

Installation

npm install colvert
# or
yarn add colvert

Usage

import { 
  hexToRgb, 
  rgbToHex, 
  randomColor,
  lighten,
  generateColorScheme 
} from 'colvert';

// Convert HEX to RGB
const rgb = hexToRgb('#0A167B');  // returns [10, 22, 123]

// Convert RGB to HEX
const hex = rgbToHex([23, 180, 60]);  // returns "#17b43c"

// Generate a random color
const randomHex = randomColor();  // returns random color in HEX format

// Lighten a color by 20%
const lightened = lighten('#ff0000', 20);  // returns lightened color in HEX

// Generate a color scheme
const scheme = generateColorScheme('#ff0000', 5);  // returns array of 5 harmonious colors

API Reference

Color Conversion Functions

RGB Conversions

  • rgbToHex(rgb: [number, number, number]): string
  • rgbToHsl(rgb: [number, number, number]): [number, number, number]
  • rgbToHsv(rgb: [number, number, number]): [number, number, number]
  • rgbToCmyk(rgb: [number, number, number]): [number, number, number, number]

HEX Conversions

  • hexToRgb(hex: string): [number, number, number]
  • hexToHsl(hex: string): [number, number, number]
  • hexToHsv(hex: string): [number, number, number]
  • hexToCmyk(hex: string): [number, number, number, number]

HSL Conversions

  • hslToRgb(hsl: [number, number, number]): [number, number, number]
  • hslToHex(hsl: [number, number, number]): string
  • hslToHsv(hsl: [number, number, number]): [number, number, number]

CMYK Conversions

  • cmykToRgb(cmyk: [number, number, number, number]): [number, number, number]
  • cmykToHex(cmyk: [number, number, number, number]): string
  • cmykToHsl(cmyk: [number, number, number, number]): [number, number, number]

Color Manipulation Functions

  • lighten(color: string, amount: number): string
  • darken(color: string, amount: number): string
  • saturate(color: string, amount: number): string
  • desaturate(color: string, amount: number): string
  • grayscale(color: string): string

Color Generation Functions

  • randomColor(): string
  • generateColorScheme(baseColor: string, count?: number): string[]

Input Formats

  • RGB: Array of three numbers [0-255]
  • HEX: String starting with '#' followed by 3 or 6 hexadecimal characters
  • HSL: Array of [hue (0-360), saturation (0-100), lightness (0-100)]
  • CMYK: Array of [cyan (0-100), magenta (0-100), yellow (0-100), key/black (0-100)]

Contributing

Contributions, issues, and feature requests are welcome! Feel free to check the issues page.

License

This project is MIT licensed.


Made with ❤️ by Abdul Muqeet