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

tailwind-cleaner

v1.0.27

Published

A tool to replace hex colors with named colors in Tailwind CSS projects

Readme

Tailwind Cleaner

Tailwind Cleaner Logo A tool to convert arbitrary values (hex colors, units, etc.) into semantic named values in Tailwind CSS projects.

Table of Contents

Features

  • Replaces hex colors and arbitrary values with semantic names in your project files
  • Converts numeric values and units (px, rem, etc.) to Tailwind's naming conventions
  • Prioritizes existing Tailwind config colors and spacing values
  • Uses Color Pizza API for color name matching
  • Falls back to color-2-name for local color matching
  • Automatically updates your tailwind.config.js with new semantic values
  • Maintains consistent naming across your entire project
  • Adding prefixes to semantic values to avoid naming conflicts
  • [NEW] Supports generating CSS variables for theming (modern Tailwind approach)

Installation

Using npx (recommended)

Run directly with npx:

npx tailwind-cleaner

Local Installation

Install locally instead of global:

npm install tailwind-cleaner --save-dev
# or
npm i -g tailwind-cleaner

Then run it using:

npx tailwind-cleaner

Tailwind CSS v4 Configuration Note

If you're using Tailwind CSS v4 with a tailwind.config.js file, add this at the top of your CSS file:

@config "./path/to/tailwind.config.js";
@import 'tailwindcss';

CSS Variables Support (New)

The tool now supports the modern approach of using CSS variables for theming. When prompted, if you choose "Yes" to use CSS variables:

  1. The tool will generate CSS variables (e.g., --primary: 255 0 0;) in your global CSS file (src/globals.css, src/index.css, etc.).
  2. It will update your tailwind.config.js to reference these variables (e.g., primary: 'rgb(var(--primary) / <alpha-value>)').

This allows for easier dynamic theming and is compatible with modern Tailwind practices.

Usage

  1. Run the tool in your project directory
  2. It will scan your project files for Tailwind classes and arbitrary values
  3. The tool will suggest semantic replacements
  4. Confirm changes to update your files and tailwind.config.js

How It Works

  1. Scans your project files for Tailwind classes and arbitrary values
  2. Matches colors against existing Tailwind config values first
  3. For new colors, uses Color Pizza API or falls back to color-2-name
  4. Converts numeric values to Tailwind's spacing scale
  5. Updates all instances with consistent semantic names
  6. Adds new values to your Tailwind config

Contributing

Contributions are welcome! Please open an issue or PR on GitHub.

License

MIT