pi-theme-switcher

Pi extension that automatically sets the theme to dark or light based on env vars, THEME_MODE, or time of day.

Packages

Package details

extension

Install pi-theme-switcher from npm and Pi will load the resources declared by the package manifest.

$ pi install npm:pi-theme-switcher
Package
pi-theme-switcher
Version
1.1.0
Published
May 15, 2026
Downloads
not available
Author
milanglacier
License
unknown
Types
extension
Size
8.1 KB
Dependencies
0 dependencies · 1 peer
Pi manifest JSON
{
  "extensions": [
    "./index.ts"
  ]
}

Security note

Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.

README

pi-theme-switcher

Pi extension that automatically switches the terminal theme between dark and light based on environment variables, THEME_MODE, or time of day.

Installation

pi install npm:pi-theme-switcher

How it works

On session start, the extension evaluates the theme in this order:

  1. PI_AGENT_THEME — set to "dark" or "light" to force a theme
  2. THEME_MODE — set to "night" (dark) or "day" (light)
  3. Time of day — fallback to dark/light based on system clock (configurable window)

The extension polls every 60 seconds to handle time-based transitions during long sessions.

Configuration

Create a config file at ~/.pi/agent/theme-switcher.json (global) or .pi/agent/theme-switcher.json (project-local):

{
  "nightStart": 22,
  "nightEnd": 6
}
  • nightStart (default: 23, 11 PM) — hour to switch to dark mode
  • nightEnd (default: 7, 7 AM) — hour to switch to light mode

Configure both fields together, or omit both to use defaults. A config with only one of these fields is ignored.

When nightStart > nightEnd (e.g., 22–6) the night range wraps around midnight. When nightStart <= nightEnd (e.g., 0–5), it does not.

Project config overrides global config when it provides both fields.

License

MIT