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

colors-helper-tools

v2.1.1

Published

help use color style ✨

Readme

colors-helper-tools

npm version npm downloads License: MIT

A versatile library and CLI tool to help you work with colors, generate palettes, calculate contrast, and more. ✨

Features

  • Fluent API: Chain methods for intuitive color manipulation.
  • Color Conversion: Convert between HEX, RGB, HSL, and HSV.
  • Color Modification: Easily lighten, darken, or get a complementary color.
  • Palette Generation: Create various types of color palettes:
    • monochromatic
    • complementary
    • analogous
    • triadic
    • split-complementary
    • shades
    • tints
    • tones
  • Contrast Calculation: Check the accessibility of your color combinations by calculating the contrast ratio.
  • Random Colors: Generate random colors, including pastel and neutral tones.
  • CLI Tool: Access most features directly from your terminal.

Installation

npm install colors-helper-tools

Usage as a Library

The library exposes a main function cht which wraps a color and allows you to use the fluent API.

import cht, { getRandomColorHex } from 'colors-helper-tools';

// --- Basic Usage ---
const myColor = cht('#3498db');

console.log(myColor.hex()); // #3498db
console.log(myColor.rgb()); // { red: 52, green: 152, blue: 219 }

// --- Chaining Methods ---
const lightenedComplementary = cht('#3498db')
  .complementary()
  .lighten(0.2)
  .hex();
console.log(lightenedComplementary); // #ffde99 (example output)

// --- Palette Generation ---
const triadicPalette = cht('#e74c3c').palette('triadic');
console.log(triadicPalette.map(c => c.hex())); // ['#e74c3c', '#3ce74c', '#4c3ce7'] (example output)

// --- Contrast Calculation ---
const contrastRatio = cht('#ffffff').contrast('#3498db');
console.log(contrastRatio.toFixed(2)); // 4.26

// --- Random Colors ---
const randomColor = getRandomColorHex();
console.log(randomColor); // e.g., #a8d8b2

Usage as a CLI

You can also use the cht command line tool.

# Get 3 random HEX colors
cht random 3

# Get 5 random RGB colors and save them to a file
cht random 5 --rgb --file

# Start an interactive prompt to get random colors
cht get_random

# Generate a 5-color monochromatic palette from a base color
cht palette monochromatic "#3498db" 5

# Get the contrast ratio between two colors
cht contrast "#ffffff" "#000000"

# Convert a color to HSL format
cht convert "#3498db" --to hsl

CLI Commands

  • cht random [number] [--rgb] [--file]: Get N random colors.
  • cht get_random: Interactive prompt for generating random colors.
  • cht palette <type> <color> [count]: Generate a color palette.
  • cht contrast <color1> <color2>: Calculate contrast ratio.
  • cht convert <color> --to <format>: Convert color format (hex, rgb, hsl).
  • cht --help: Show all commands and options.

Contributing

Contributions are welcome! Please feel free to submit a pull request or open an issue.

License

This project is licensed under the MIT License.