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

string-palette

v0.0.3

Published

[![npm version](https://img.shields.io/npm/v/string-palette?color=blue&logo=npm)](https://www.npmjs.com/package/string-palette) [![License](https://img.shields.io/badge/license-MIT-green)](https://github.com/lordronz/string-palette/blob/main/LICENSE) [![G

Readme

🎨 String Palette

npm version License GitHub stars

String Palette is a lightweight, zero-dependency TypeScript library for generating consistent and vibrant colors from strings. Whether you're building a data visualization app, a tag-based color system, or just need a fun way to map strings to colors, String Palette has you covered.


✨ Features

  • String to Color: Generate consistent hex colors from any string.
  • Random Colors: Generate random hex colors effortlessly.
  • Color Utilities: Check if a color is dark, adjust brightness, and more.
  • Lightweight: Zero dependencies, minimal footprint.
  • TypeScript Support: Fully typed for a seamless developer experience.

🚀 Installation

Install the library via npm:

npm install string-palette

Or using yarn:

yarn add string-palette

🛠️ Usage

Generate a Color from a String

import { stringToColor } from 'string-palette';

const color = stringToColor('hello world');
console.log(color); // e.g., "#1a2b3c"

Generate a Random Color

import { randomColor } from 'string-palette';

const color = randomColor();
console.log(color); // e.g., "#4d5e6f"

Check if a Color is Dark

import { isDarkColor } from 'string-palette';

const dark = isDarkColor('#000000');
console.log(dark); // true

Adjust Color Brightness

import { adjustBrightness } from 'string-palette';

const lighterColor = adjustBrightness('#000000', 20);
console.log(lighterColor); // e.g., "#333333"

📚 API Reference

stringToColor(input: string): string

Generates a hex color from a given string.

  • input: The string to generate a color from.

randomColor(): string

Generates a random hex color.

isDarkColor(color: string): boolean

Checks if a color is dark.

  • color: The hex color to check.

adjustBrightness(color: string, amount: number): string

Adjusts the brightness of a color.

  • color: The hex color to adjust.

  • amount: The amount to adjust the brightness by.

🤔 Why Use String Palette?

  • Consistent Colors: The same string always produces the same color, making it perfect for tagging or categorization.

  • Dynamic and Fun: Easily add vibrant colors to your app without hardcoding values.

  • Developer-Friendly: Built with TypeScript for type safety and ease of use.

  • Lightweight: No dependencies, so it won’t bloat your project.

🎨 Example Use Cases

  • Tagging System: Assign unique colors to tags or categories based on their names.

  • Data Visualization: Generate colors for charts or graphs dynamically.

  • User Avatars: Create colorful avatars based on usernames or emails.

  • UI Enhancements: Add dynamic backgrounds or accents to your app.

🤝 Contributing

Contributions are welcome! If you have an idea for a new feature or find a bug, please open an issue or submit a pull request.

  • Fork the repository.

  • Create a new branch (git checkout -b feature/your-feature).

  • Commit your changes (git commit -m 'Add some feature').

  • Push to the branch (git push origin feature/your-feature).

  • Open a pull request.

📄 License

This project is licensed under the MIT License. See the LICENSE file for more details.