pi-theme-switcher
v1.1.0
Published
Pi extension that automatically sets the theme to dark or light based on env vars, THEME_MODE, or time of day.
Downloads
425
Maintainers
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-switcherHow it works
On session start, the extension evaluates the theme in this order:
PI_AGENT_THEME— set to"dark"or"light"to force a themeTHEME_MODE— set to"night"(dark) or"day"(light)- 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 modenightEnd(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
