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/css-in-js

v0.1.15

Published

Instructure theme object for runtime CSS-in-JS (Emotion, styled-components, Stitches): camelCased tokens, var()-backed.

Readme

@pantoken/css-in-js

An Instructure theme object for runtime CSS-in-JS libraries. It works with anything that reads a theme from props.theme — Emotion, styled-components, and Stitches all share that convention. Keys are camelCased tokens; values are var(--instui-*) references by default, so light, dark, and high-contrast switching all flow through the CSS custom properties.

Install

npm i @pantoken/css-in-js @pantoken/css

You need @pantoken/css too. It defines the --instui-* custom properties this theme points at.

Also available as pantoken/cssInJs.

Usage

import styled, { ThemeProvider } from "styled-components";
import { pantokenTheme } from "@pantoken/css-in-js";

const Button = styled.button`
  background: ${({ theme }) => theme.colorBackgroundBrand};
  color: ${({ theme }) => theme.colorTextOnColor};
`;

export const App = () => <ThemeProvider theme={pantokenTheme}>...</ThemeProvider>;

The same object works with Emotion:

import { useTheme } from "@emotion/react";
const theme = useTheme();
// theme.colorTextBase → "var(--instui-color-text-base)"

Every non-icon token becomes a camelCased key: --instui-color-background-brandcolorBackgroundBrand. Icons are skipped — use @pantoken/icons for those.

To bake concrete values for one mode (for example, server rendering without CSS variables), pass resolve:

import { toStyledTheme } from "@pantoken/css-in-js";
import { tokens } from "@pantoken/tokens";

const dark = toStyledTheme(tokens, { resolve: "dark" });
// dark.colorBackgroundBase → "#000" (a concrete value, not a var())

To type theme.* in styled-components, augment its DefaultTheme:

import type { StyledTheme } from "@pantoken/css-in-js";

declare module "styled-components" {
  export interface DefaultTheme extends StyledTheme {}
}

API

  • pantokenTheme: Record<string, string> — the ready-made rebrand theme object, var()-backed.
  • toStyledTheme(tokens, options?): StyledTheme — build a theme object from a token IR. Pass { resolve: "light" | "dark" } to bake concrete single-mode values instead of var() references.
  • toThemeKey(name): string — turn --instui-color-background-brand into colorBackgroundBrand.
  • StyledTheme — the theme object type (Record<string, string>); augment styled-components' DefaultTheme with it.
  • ToStyledThemeOptions, Mode — option and mode types.

Related

  • Pairs with @pantoken/css for the --instui-* custom properties the theme points at.
  • Use @pantoken/icons for icon tokens, which this theme skips.

License

MIT