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

virtari-color-engine

v0.1.0

Published

Framework-agnostic OKLCH palette generation, contrast selection, and Virtari token export.

Readme

virtari-color-engine

Framework-agnostic color generation for Virtari and other token-based interfaces. It creates sRGB-gamut-mapped OKLCH scales, suggests accent harmonies, chooses black or white foregrounds using WCAG 2.2 contrast ratios, and exports a replaceable Virtari token bundle as JSON or CSS.

pnpm add virtari-color-engine
import { generateVirtariTheme, recommendNeutralPalette, themeToCss } from "virtari-color-engine";

const neutral = recommendNeutralPalette("#4F46E5", "#24B39B");

const theme = generateVirtariTheme({
  name: "Acme",
  primary: "#4F46E5",
  accentStrategy: "complementary",
  neutral,
});

document.documentElement.dataset.brand = "custom";
const css = themeToCss(theme);

Load the generated CSS after Virtari's token stylesheet. The export overrides both the primitive scales and the canonical --vds-color-on-primary / --vds-color-on-accent foreground roles for light, dark, and dark OLED themes.

The generator returns twelve-step light and dark neutral, primary, and accent scales. Steps follow Virtari’s role progression: quiet surfaces at 1–5, boundaries at 6–8, solid fills at 9–10, and readable text at 11–12.

API

  • generateNeutralScale(theme, options) creates neutral or tinted-gray scales.
  • NEUTRAL_PALETTE_PRESETS provides more than twenty named neutral foundations.
  • recommendNeutralPalette(primary, accent?) derives a quiet neutral tint from the active brand relationship.
  • generateColorScale(seed, theme, role) creates a primary or accent scale from a hex seed. The optional role defaults to primary.
  • suggestAccents(primary) returns complementary, analogous, triadic, and split-complementary candidates.
  • chooseForeground(background) returns black or white and AA/AAA results.
  • contrastRatio(foreground, background) implements the WCAG 2.x relative-luminance ratio.
  • generateVirtariTheme(options) creates the versioned portable theme document.
  • themeToJson(theme) and themeToCss(theme, { brand }) create downloadable outputs. Brand names are restricted to safe CSS identifier characters.
  • parseNeutralImport(json) validates a Gray Shade Maker or full-theme JSON payload.

Pass neutralAccent: true to generateVirtariTheme for a No Accent system. Accent token roles remain available to components, but they resolve to the generated neutral scale instead of introducing another brand color.

Accessibility scope

The package reports WCAG 2.2 AA and AAA text thresholds from the sRGB relative-luminance formula. The result describes the exact opaque color pair passed to the function; it is not a page-level conformance claim. WCAG 3 and APCA remain developing work and are not presented as conformance claims. Always test final composited colors, interaction states, large-text classification, forced colors, and non-text cues in the consuming product.

License

MIT © 2026 Virtari.