pi-theme-flip

Pi package adding a non-blocking command to sync light and dark themes across sessions

Packages

Package details

extension

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

$ pi install npm:pi-theme-flip
Package
pi-theme-flip
Version
0.2.0
Published
Jul 18, 2026
Downloads
34/mo · 9/wk
Author
adstastic
License
MIT
Types
extension
Size
8.6 KB
Dependencies
0 dependencies · 1 peer
Pi manifest JSON
{
  "extensions": [
    "./src/index.ts"
  ]
}

Security note

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

README

pi-theme-flip

A tiny Pi extension that immediately syncs light/dark theme changes across every Pi session running as the same user.

No polling. No OS detection. No subprocesses. Sessions share one state file and watch it with filesystem events.

Install

From npm:

pi install npm:pi-theme-flip

Try without installing:

pi -e npm:pi-theme-flip

From this repository:

npm install
npm run check
pi -e ./src/index.ts

Or install/use it as a Pi package from a local path:

pi install /absolute/path/to/pi-theme-flip

Use

/theme-flip
/theme-flip toggle
/theme-flip dark
/theme-flip light
/theme-flip status

/theme-flip toggles between Pi's built-in dark and light themes. Pi extension commands execute immediately while the agent is streaming, without interrupting its turn.

Every loaded session updates from ~/.pi/agent/theme-flip. New sessions read the same file on startup, and existing sessions recheck it before each prompt in case a filesystem event was missed.

After first install or update, restart existing Pi sessions or run /reload once in each idle session.

External control

Other processes can set every session by atomically replacing the shared state file:

mkdir -p ~/.pi/agent
printf 'dark\n' > ~/.pi/agent/.theme-flip.tmp
mv -f ~/.pi/agent/.theme-flip.tmp ~/.pi/agent/theme-flip

This gives a laptop-side macOS appearance watcher one simple target to update over SSH.

Behavior

  • Shared dark flips to light; shared light flips to dark.
  • Without shared state, the current session theme determines the first toggle.
  • dark and light force one side in every loaded session.
  • status reports the current session's active theme.
  • Missing or invalid shared state is ignored.
  • Non-UI modes no-op.