Skip to content

lederniermagicien/pi-auto-theme

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pi-auto-theme

npm version

A simple extension for the pi coding agent that automatically changes the theme from dark to light (and vice versa) based on the theme of your operating system.

pi-auto-theme demo

Features

  • Instant Reactions: This extension does NOT depend on 'polling' every N seconds. Instead, it uses crossterm-system-theme with a native listener for theme changes, allowing it to react to OS-level theme changes instantly.
  • (Note: It does fall back to a 3-second poll in certain Linux desktop environments if it cannot find a way to listen natively, but this rarely happens.)
  • No Clutter: This pi extension is lightweight. It adds a single /theme command to allow manual overrides.
  • Commands:
    • /theme auto: Syncs the theme with your OS natively.
    • /theme dark: Overrides auto-sync and forces dark theme.
    • /theme light: Overrides auto-sync and forces light theme.

Installation

Install the extension globally:

pi install npm:pi-auto-theme

Install it only for the current project:

pi install npm:pi-auto-theme -l

Or run it temporarily without installing:

pi -e npm:pi-auto-theme

If you have cloned the repository, you can run it from the local directory:

pi -e ./index.ts

How it works

When the extension is loaded, it checks the current OS theme and immediately sets the pi UI theme. It also sets up a native theme change listener using crossterm-system-theme. If your OS switches between Light and Dark mode, the pi TUI will update instantly without restarting the session.

License

ISC

About

pi coding agent - auto dark/light theme extension

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • TypeScript 100.0%