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

@coston/design-tokens

v0.4.0

Published

Centralized design tokens for modern web applications

Readme

@coston/design-tokens

Production-ready CSS design tokens built with OKLCH colors. Framework-agnostic, semantic naming, and built-in light/dark themes.

Features

  • Pure CSS Variables - Zero runtime, works everywhere
  • OKLCH Colors - Perceptually uniform, mathematically sound (see resources/color-theory.md)
  • Gamut-Aware - Automatic sRGB gamut mapping ensures all colors are displayable
  • Semantic Tokens - primary, secondary, muted, etc. work across light/dark themes
  • Framework Agnostic - React, Vue, Svelte, Angular, vanilla JS, or any CSS
  • WCAG Validated - Automatic contrast checking
  • TypeScript Support - Full type definitions included
  • Optional Tailwind - Pre-built integration if you want utility classes

Quick Start

1. Install

npm install @coston/design-tokens

2. Import in your CSS

/* styles.css */
@import '@coston/design-tokens/tokens.css';

Or in JavaScript:

import '@coston/design-tokens/tokens.css';

3. Use CSS variables

.button {
  background: var(--primary);
  color: var(--primary-foreground);
  border-radius: var(--radius);
  padding: 0.5rem 1rem;
}

.card {
  background: var(--card);
  color: var(--card-foreground);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

Optional: Tailwind Integration

Using Tailwind? Import tailwind.css instead for utility classes:

/* styles.css */
@import '@coston/design-tokens/tailwind.css';

Then use Tailwind classes:

<div className="bg-primary text-primary-foreground">
  <button className="bg-secondary text-secondary-foreground rounded-sm">Click me</button>
</div>

Dark Mode

Toggle dark mode by adding/removing the .dark class on the document root:

// Toggle dark mode
document.documentElement.classList.toggle('dark');

// Or set explicitly
document.documentElement.classList.add('dark'); // Enable
document.documentElement.classList.remove('dark'); // Disable

Alternative Themes

Apply alternative color themes using data-theme:

// Available: "forest" (green), "purple" (muted)
document.documentElement.dataset.theme = 'forest';

// Combine with dark mode
document.documentElement.dataset.theme = 'purple';
document.documentElement.classList.add('dark');

Available Tokens

Colors:

  • --background, --foreground - Page background and text
  • --primary, --primary-foreground - Primary actions
  • --secondary, --secondary-foreground - Secondary actions
  • --card, --card-foreground - Card backgrounds
  • --muted, --muted-foreground - Subtle elements
  • --accent, --accent-foreground - Accent highlights
  • --destructive, --destructive-foreground - Danger actions
  • --border, --input, --ring - Borders and focus rings
  • --chart-1 through --chart-5 - Chart colors
  • --sidebar-* - Sidebar-specific tokens

Other:

  • --radius - Border radius (0.5rem default)

JavaScript/TypeScript Access

Access token values from the JSON file:

import tokens from '@coston/design-tokens/tokens.json';

console.log(tokens.semantic.primary); // "oklch(0.530 0.186 255)"
console.log(tokens.themes.dark.background); // "oklch(0.137 0 0)"

Advanced: Custom Theme Generation

Generate a complete custom theme from your brand color:

import { generateThemeFromColor } from '@coston/design-tokens';

const theme = generateThemeFromColor({
  baseColor: 'oklch(0.6 0.15 280)', // Your brand color
  hueRange: 30, // Optional: hue variation range (default: 60)
});

// Returns { light: {...}, dark: {...} }
// Each contains all semantic tokens (primary, secondary, etc.)
console.log(theme.light.primary); // "oklch(0.530 0.186 280)"
console.log(theme.dark.background); // "oklch(0.137 0 0)"

This generates a mathematically balanced theme with proper contrast ratios for both light and dark modes.

Package Exports

  • @coston/design-tokens - Theme generation utility (generateThemeFromColor)
  • @coston/design-tokens/tokens.json - Token data (core, semantic, themes)
  • @coston/design-tokens/tokens.css - Pure CSS variables
  • @coston/design-tokens/tailwind.css - Tailwind utility classes

Demo

🎨 View Live Demo

Interactive showcase with component examples, theme switching, and token visualization.

See the demo/ directory for the source code and local development:

npm install && npm run build
cd demo && npm install && npm run dev

Documentation

License

MIT