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

@pantoken/plugin-colors

v0.1.3

Published

pantoken plugin: CSS-only color math (alpha, darken, lighten, overlayColors) that mirrors the InstUI ui-color-utils, built on color-mix() and relative color syntax.

Readme

@pantoken/plugin-colors

CSS-only color math that mirrors the InstUI @instructure/ui-color-utils helpers, so derived shades track pantoken's var(--instui-*) tokens at runtime instead of being baked to a fixed hex.

InstUI computes alpha, darken, lighten, and overlayColors at build time with tinycolor2 against concrete colors. pantoken emits token references that resolve in the browser — often through light-dark() — so the same math has to run in CSS. Each helper returns a CSS color string built on color-mix() and relative color syntax (both Baseline modern-browser features).

Install

npm i @pantoken/plugin-colors

Also available as pantoken/colors.

Usage

import { alpha, darken, lighten, overlayColors } from "@pantoken/plugin-colors";

alpha("var(--brand)", 10); // color-mix(in srgb, var(--brand) 10%, transparent)
darken("var(--brand)", 10); // hsl(from var(--brand) h s calc(l - 10))
lighten("var(--brand)", 10); // hsl(from var(--brand) h s calc(l + 10))
overlayColors("var(--surface)", "var(--brand)", 12); // color-mix(in srgb, var(--brand) 12%, var(--surface))
onColor("var(--brand)"); // black or white, whichever reads on the surface (InstUI's *-on-color idea)

// Compose them the way InstUI does — e.g. a brand-tinted ghost-button hover:
const ghostHover = alpha(
  darken("var(--instui-color-institutional-brand-button-primary-bgd)", 10),
  10,
);

Mapping to ui-color-utils

| ui-color-utils (tinycolor) | This helper | CSS mechanism | | --------------------------- | --------------- | ----------------------------------- | | alpha(color, percent) | alpha | color-mix() with transparent | | darken(color, percent) | darken | hsl(from …) relative color syntax | | lighten(color, percent) | lighten | hsl(from …) relative color syntax | | overlayColors(c1, c2) | overlayColors | color-mix() (opaque base only) | | *-on-color token variants | onColor | oklch(from …) contrast clamp |

darken, lighten, and overlayColors cover the RGBA-over-opaque case; general RGBA-over-RGBA compositing can't be a single CSS color, so it's out of scope. onColor mirrors InstUI's recurring *-on-color variants (focus-ring-on-color, primary-inverse, and more) — instead of a fixed inverse token, it derives black/white contrast from the surface, so it tracks whatever colour it sits on.