← Catalog

@jocax/theme-cycler

Keyboard-driven theme cycling with swatch widget and per-extension defaults for pi

Extension

Install

Install with PiG

pig install npm:@jocax/theme-cycler

Install with Pi

pi install npm:@jocax/theme-cycler
Review before installing

Packages run code with your permissions and influence agent behavior. Catalog inclusion is not a security audit. Review the source before installing a third-party package.

Pi manifest JSON

The pi field of package.json.

{
  "extensions": [
    "./dist/index.js"
  ]
}

README

Written by the package's publisher, shown as published in version 0.2.1 (README.md). PiG does not review it.

@jocax/theme-cycler

Keyboard-driven theme cycling with a color swatch widget and per-extension theme defaults for pi.

What

Three things in one package:

  • Theme cycler — Ctrl+Q / Shift+Ctrl+Q shortcuts to cycle themes forward/backward, plus a /theme command with a select dialog
  • Color swatch — A transient widget showing 5 theme color tokens (success/accent/warning/dim/muted) that auto-dismisses after 3 seconds
  • Theme map — A utility that assigns default themes per extension and sets the terminal title

Why

Quickly explore and switch themes without leaving the keyboard. Assign default themes per extension for consistent visual context — every extension can pick its own color vibe.

Install

Install the package from npm:

{
  "source": "npm:@jocax/theme-cycler"
}
# Try it from a local checkout without installing
pi -e ./src/index.ts

Usage

Shortcuts

ShortcutAction
Ctrl+QCycle theme forward (next)
Shift+Ctrl+QCycle theme backward (previous)

Each cycle shows a notification with the theme name and position (e.g., "nord (3/12)") and flashes a color swatch widget for 3 seconds.

Commands

CommandAction
/themeOpen select dialog with all available themes
/theme <name>Switch directly to the named theme

Status Line

The extension adds 🎨 <theme-name> to the pi status bar, updating after every switch.

Theme Map API

Use the THEME_MAP export to assign default themes per extension:

import { THEME_MAP, applyExtensionDefaults } from "@jocax/theme-cycler/themeMap";

// Add custom theme mappings before calling applyExtensionDefaults
THEME_MAP["my-extension"] = "dracula";

export default function (pi: ExtensionAPI) {
  pi.on("session_start", async (_event, ctx) => {
    applyExtensionDefaults(import.meta.url, ctx);
    // ... your extension logic
  });
}

applyExtensionDefaults() does two things:

  1. Applies the theme mapped for your extension (falls back to synthwave if no mapping)
  2. Sets the terminal title to π - <extension-name>

When multiple extensions are stacked (e.g., pi -e ext-a.ts -e ext-b.ts), only the first extension's theme is applied. Secondary extensions skip theme assignment.

Default Theme Mappings

ExtensionTheme
footer-toolkitsynthwave
theme-cyclersynthwave

Edit THEME_MAP to change these or add your own.

Available Themes

The package discovers themes from .pi/themes/ and pi's built-ins. The following themes ship with ae-pi:

ae-adws-dark · catppuccin-mocha · cyberpunk · dracula · everforest gruvbox · midnight-ocean · nord · ocean-breeze · rose-pine · synthwave · tokyo-night

Examples

# Standalone theme cycler
pi -e software/packages/theme-cycler/examples/basic.ts

# Stacked with minimal footer
pi -e software/packages/theme-cycler/examples/with-minimal.ts

Both examples run independently — no install required.

Run the demo

just demo theme-cycler

A herdr workspace opens with pi, this extension and a disposable copy of the small-app sandbox. The agent starts reading files; while it works:

StepDo thisWatch
1Press Ctrl+QThe theme switches, a notification shows <name> (n/2), the status line shows 🎨 <name>, and the swatch flashes below the editor for 3 seconds
2Press Ctrl+Q againThe theme switches back
3Press Shift+Ctrl+QThe theme cycles backward
4Type /themeA select dialog lists every theme, the active one marked (active)
5Type /theme lightSwitches by name; an unknown name reports an error instead

The swatch shows the five color roles in order — success, accent, warning, dim, muted — so a theme's palette is visible at a glance.

pi reserves Ctrl+X for copying the last agent message, so this package uses Ctrl+Q and reverses it with Shift, the way pi's own model-cycle pair works.

A demo session sees only pi's built-in dark and light themes, which is why the counter reads 2. The kit starts pi with --no-approve, so a .pi/themes/ inside the sandbox stays untrusted, and the session's pi agent directory is empty. For the same reason the per-extension default (synthwave) does not apply in a demo.

Needs herdr 0.9.3 or newer and one reachable model provider — see demo-kit.

API

ExportTypeDescription
THEME_MAPRecord<string, string>Extension name → theme name mapping. Mutable.
applyExtensionDefaults(fileUrl, ctx)(string, ExtensionContext) => voidApply mapped theme + set terminal title
applyExtensionTheme(fileUrl, ctx)(string, ExtensionContext) => booleanApply mapped theme only