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

tweakpane-draggable-theme

v1.0.8

Published

Dark theme for Tweakpane UI controls with draggable support

Downloads

25

Readme

Tweakpane Draggable Theme

Dark, legible styling for Tweakpane with an optional draggable header and collapse control.

Features

  • Dark blue-grey palette with clear type and affordances
  • Scoped .tp-dark-theme variables so the theme stays self-contained
  • Optional draggable header with built-in collapse button
  • Programmatic helpers to enable/disable dragging and adjust position
  • Auto-injected styles (no network fetch) plus a distributable CSS file for manual control

Installation

npm install tweakpane-draggable-theme

Usage

Apply the theme to an existing pane

import { Pane } from 'tweakpane';
import { applyTheme } from 'tweakpane-draggable-theme';

const pane = new Pane({ title: 'Settings' });

// Apply styling and make the pane draggable
const api = applyTheme(pane, {
  draggable: true,        // defaults to true
  dragThreshold: 3,       // pixels before a drag starts
  boundaryPadding: 10,    // viewport inset in pixels
  title: 'Controls'       // header label shown in the drag bar
});

applyTheme injects the stylesheet once via an inline <style> tag, adds the .tp-dark-theme class to the pane DOM element, and (optionally) prepends the custom header used for dragging. The inline injection avoids Vite-style optimizer warnings that happen when packages load relative CSS files at runtime.

Theme API

The object returned from applyTheme exposes:

  • setDraggable(enabled: boolean) – Toggle the draggable header at runtime.
  • setPosition({ top, right, bottom, left }) – Manually position the pane (CSS values such as '120px' or '10%').
  • getPosition() – Returns the pane’s current offset relative to the viewport ({ top, right, bottom, left } in pixels).

Create a themed pane in one call

import { createThemedPane } from 'tweakpane-draggable-theme';

const { pane, api } = await createThemedPane(
  { title: 'Settings' },        // forwarded to the Tweakpane constructor
  { draggable: true, title: 'Demo Controls' } // same options as applyTheme
);

createThemedPane loads Tweakpane on demand, constructs a pane, and applies the theme before returning { pane, api }.

Controlling CSS injection yourself

By default applyTheme/createThemedPane call injectThemeStyles(document) for you. If you prefer to manage styles manually you have two options:

// Option 1: import the packaged stylesheet once at app startup
import 'tweakpane-draggable-theme/css';

// Option 2: inject the CSS string on demand
import { injectThemeStyles, getThemeCss } from 'tweakpane-draggable-theme';

injectThemeStyles();       // inserts a <style> tag if it does not exist
const css = getThemeCss(); // string export for SSR or custom bundlers

applyTheme will detect the existing <style> tag created by either approach and skip a second injection, so you can keep manual control without warnings.

CSS-only usage

If you simply want the dark styling without the JavaScript helpers:

<link rel="stylesheet" href="/node_modules/tweakpane-draggable-theme/tweakpane-theme.css">
<div class="tp-dark-theme">
  <!-- Tweakpane will render here -->
</div>

Make sure the element that hosts the pane receives the tp-dark-theme class so the scoped rules apply.

Customisation

All colours derive from CSS custom properties defined on .tp-dark-theme. Override them to match your brand:

.tp-dark-theme {
  --tp-base-background-color: hsla(210, 24%, 12%, 1);
  --tp-container-foreground-color: hsla(210, 20%, 80%, 1);
  --tp-input-background-color-hover: hsla(210, 24%, 16%, 1);
  /* Draggable header */
  --tp-drag-header-background-color: hsla(210, 24%, 10%, 1);
  --tp-drag-header-foreground-color: hsla(210, 24%, 85%, 1);
  --tp-drag-handle-color: hsla(210, 24%, 65%, 1);
}

The draggable header, folder levels, and dropdowns each expose dedicated variables (for example --tp-drag-header-background-color-hover, --tp-folder-background-color-level2, --tp-dropdown-item-foreground-color-selected) so you can tweak the new components without increasing selector specificity.

Key surface colours (defaults shown):

  • Pane background: hsla(220, 18%, 10%, 1)
  • Drag header: hsla(220, 18%, 7%, 1) (hover 9%, active 12%)
  • Text: hsla(220, 14%, 75%, 1)
  • Buttons (default): hsla(220, 14%, 25%, 1) with lighter hover/active states
  • Folder hierarchy: lightens slightly at each nested level (10% → 13% → 16% → 19%)

Styled components

The theme provides coverage for:

  • Pane containers, headers, and separators
  • Folder hierarchies (including the collapse chevron)
  • Inputs (text, number, slider), buttons, and monitors
  • Dropdown lists and popup menus

Browser support

Modern browsers that support CSS custom properties (current Chrome, Edge, Firefox, Safari). Internet Explorer is not supported.

Development

git clone https://github.com/jeffreycastellano/tweakpane-draggable-theme.git
cd tweakpane-draggable-theme
# Files are plain CSS/ES modules – no build step required.

License

MIT