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

@styleglide/theme-editor

v0.0.16

Published

Add the StyleGlide theme editor to any shadcn/ui app

Downloads

410

Readme

@styleglide/theme-editor

You can load the StyleGlide theme editor into any app that uses the shadcn/ui design system with this lightweight, zero-dependency JS package.

Quickstart

Initialize the theme editor via CDN.

<script defer src="https://unpkg.com/@styleglide/theme-editor"></script>

This line of code is all you need to start using the theme editor.

  • A button that activates it will appear in the bottom center of your screen
  • StyleGlide generates Tailwind CSS palettes and shadcn/ui themes on demand
  • Your application updates with a real-time preview
  • You can copy the current theme or install it with the shadcn CLI

What the CDN install handles automatically:

  • Checks dark class on <html> and theme in localStorage for mode toggle integration
  • Detects CSS channels vs colorSpace format in CSS theme vars

Next.js

Add the CDN link to a next/script tag in your app/layout.tsx

import Script from "next/script";

export default function RootLayout({ children }) {
  return (
    <html>
      <body>
        <Script src="https://unpkg.com/@styleglide/theme-editor" />
        {children}
      </body>
    </html>
  );
}

Manual Setup

For more control over how the theme editor is initialized, you can install the package via NPM.

For this example we'll use the Next.js App Router, but the basics remain the same for any React app.

Note: React is not required to run the theme editor. In fact, you can even use it with shadcn/ui ports that use more traditional web stacks such as basecoat.

1. Install the package

pnpm add @styleglide/theme-editor
npm install @styleglide/theme-editor
yarn add @styleglide/theme-editor
bun add @styleglide/theme-editor

2. Create a theme editor component:

"use client";

import { useEffect } from "react";
import { useTheme } from "next-themes";
import { themeEditor } from "@styleglide/theme-editor";

export function ThemeEditor() {
  const { setTheme, resolvedTheme } = useTheme();

  useEffect(() => {
    themeEditor({
      enabled: process.env.NODE_ENV === "development",
      onChangeMode: setTheme,
      resolvedMode: resolvedTheme,
    });
  }, [resolvedTheme, setTheme]);

  return null;
}

3. Add it to your root layout as a child of your theme provider:

import { ReactNode } from "react";
import { ThemeEditor } from "@/components/theme-editor";
import { ThemeProvider } from "next-themes";

export default function RootLayout({ children }: { children: ReactNode }) {
  return (
    <html lang="en" suppressHydrationWarning>
      <body>
        <ThemeProvider>
          <ThemeEditor />
          {children}
        </ThemeProvider>
      </body>
    </html>
  );
}

CSS Color Format

The default cssColorFormat is colorSpace and works for Tailwind v4 CSS vars like hsl(0 0% 45.1%).

For Tailwind v3 vars like 0 0% 45.1%, use the "channels" format:

themeEditor({
  // ...
  cssColorFormat: "channels",
});

Custom Open Button

By default, the theme editor creates a floating StyleGlide button to open the editor. You can use your own custom button instead by adding the data-theme-editor-open attribute:

<button data-theme-editor-open>Open Theme Editor</button>

API Reference

themeEditor

The main function to initialize the theme editor.

themeEditor(options: ThemeEditorOptions): void

type ThemeEditorOptions

An object containing the configuration for the theme editor.

| Property | Type | Default | | ---------------- | ----------------------------------- | -------------- | | resolvedMode | 'light' \| 'dark' | 'light' | | onChangeMode | (mode: 'light' \| 'dark') => void | - | | enabled | boolean | true | | cssColorFormat | 'channels' \| 'colorSpace' | 'colorSpace' |