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

tonium

v2.0.1

Published

A safe color-theme assistant for Next.js + Tailwind CSS v4 + shadcn/ui projects

Readme

Tonium v2

Tonium is a safe color-theme CLI for Next.js projects using Tailwind CSS v4 and shadcn/ui.

It audits globals.css, generates semantic light and dark theme tokens from a palette, preserves the shadcn/ui structure, checks contrast, separates visual surfaces, moves custom CSS out of the theme file, and can maintain Tonium rules in AGENTS.md.

Features

  • Audit Next.js, Tailwind CSS v4 and shadcn/ui setup.
  • Detect app/globals.css or src/app/globals.css.
  • Check required, optional and legacy shadcn/ui tokens.
  • Generate semantic light and dark theme tokens from a palette.
  • Preserve the theme file structure instead of rewriting the full CSS file.
  • Validate core WCAG contrast pairs.
  • Keep readable brand colors in dark mode when possible.
  • Separate background, card, popover, muted, border, input and sidebar surfaces.
  • Protect destructive from unsafe or duplicated semantic colors.
  • Move custom top-level CSS blocks into app/styles/customs.css or src/app/styles/customs.css.
  • Add or update a Tonium managed section in AGENTS.md.
  • Create a .tonium-backup copy before writing to globals.css.

Installation

npm install -D tonium
npx tonium@latest --help
pnpm dlx tonium@latest --help

Quick usage

tonium audit
tonium theme "#2563eb" "#f97316" "#111827" --preview
tonium theme "#2563eb" "#f97316" "#111827" --apply
tonium clean --preview
tonium clean --apply
tonium agents
tonium agents --apply

Commands

tonium audit

Checks framework setup, the theme file location, missing shadcn/ui tokens, optional or legacy token names, WCAG contrast issues and custom CSS mixed into globals.css.

tonium audit --json
tonium audit --strict

Recent shadcn/ui presets use --sidebar as the required sidebar token. --destructive-foreground is optional. Legacy --sidebar-background is accepted but not required. When actionable issues are found, Tonium prints a Next Action.

tonium theme

Generates a complete light and dark shadcn/ui theme from palette colors.

tonium theme "#2563eb" "#f97316" "#111827" --preview
tonium theme "#2563eb" "#f97316" "#111827" --apply
tonium theme "#2563eb" "#f97316" "#111827" --format oklch --preview
tonium theme "#2563eb" "#f97316" "#111827" --format hex --preview
tonium theme "#2563eb" "#f97316" "#111827" --apply --yes
tonium theme "#2563eb" "#f97316" "#111827" --apply --update-agents

Options: --format <oklch|hex|rgb|hsl|input>, --preview, --apply, --yes, --update-agents, --no-update-agents.

Before writing, Tonium creates a .tonium-backup copy of globals.css.

Theme behavior

Tonium maps palette colors to semantic shadcn/ui roles:

background, foreground, card, card-foreground, popover, popover-foreground
primary, primary-foreground, secondary, secondary-foreground
muted, muted-foreground, accent, accent-foreground
destructive, destructive-foreground, border, input, ring
sidebar, sidebar-primary, sidebar-accent, chart-1 to chart-5

Tonium does not try to use every palette color. It selects semantic roles, preserves shadcn/ui defaults when they are better, and generates missing values only when needed.

In dark mode, brand colors are preserved when they pass contrast checks and adjusted only when needed. Dark surfaces are separated so cards, popovers, muted areas, borders, inputs and sidebars remain distinct from the page background.

The destructive token must remain a danger color, cannot duplicate primary, secondary or accent, and cannot automatically use pastel, blue, green, cyan or violet colors. If no distinct danger color is available, Tonium keeps the shadcn/ui default. destructive-foreground is generated or corrected when present.

tonium clean

Moves non-standard top-level CSS blocks out of globals.css into app/styles/customs.css or src/app/styles/customs.css.

When needed, Tonium inserts:

@import "./styles/customs.css";
tonium clean --preview
tonium clean --apply
tonium clean --apply --yes

tonium agents

Creates or updates the Tonium managed section in AGENTS.md.

tonium agents
tonium agents --apply

Content outside these markers is preserved:

<!-- BEGIN:tonium-agent-rules -->
<!-- END:tonium-agent-rules -->

Public API

import { detectProject, parseCssFile, detectIntruders, parseColors, classifyColors, mapPaletteToTheme, createCli } from "tonium";

Project layout

src/
  bin/tonium.ts
  cli/{commands,index.ts,shared.ts}
  core/{agents,colors,css,project,safety,theme}/
  types/
  utils/

Development

npm install
npm run build
npm run test:theme-fixtures
node dist/bin/tonium.js --help

Windows PowerShell fallback:

npm.cmd run build
npm.cmd run test:theme-fixtures
npm.cmd pack --dry-run

Package outputs: dist/bin/tonium.js for the CLI and dist/index.js for the library.

Release notes

2.0.1

Tonium 2.0.1 improves safe theme generation, dark mode output and CLI consistency:

  • Brand colors are preserved in dark mode when contrast allows it.
  • Light and dark surfaces are separated to avoid visual collapse.
  • destructive must remain a real danger color and cannot duplicate primary, secondary or accent.
  • Preview commands display a clear Next Action.
  • Apply commands print Theme Apply, Clean Apply or Agents Apply.
  • theme --apply --yes updates AGENTS.md only with --update-agents.
  • Fixtures cover pastel, neon, surface-depth and destructive-token edge cases.