An open API service indexing awesome lists of open source software.

https://github.com/championswimmer/pi-auto-theme

pi coding agent - auto dark/light theme extension
https://github.com/championswimmer/pi-auto-theme

dark-mode light-mode pi pi-agent pi-coding-agent system-theme

Last synced: 1 day ago
JSON representation

pi coding agent - auto dark/light theme extension

Awesome Lists containing this project

README

          

# pi-auto-theme

[![npm version](https://img.shields.io/npm/v/pi-auto-theme.svg)](https://www.npmjs.com/package/pi-auto-theme)

A simple extension for the [pi coding agent](https://github.com/badlogic/pi-mono) that automatically changes the theme from dark to light (and vice versa) based on the theme of your operating system.

![pi-auto-theme demo](./pi-theme.gif)

## Features

- **Instant Reactions**: This extension does **NOT** depend on 'polling' every N seconds. Instead, it uses [crossterm-system-theme](https://github.com/championswimmer/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:

```bash
pi install npm:pi-auto-theme
```

Install it only for the current project:

```bash
pi install npm:pi-auto-theme -l
```

Or run it temporarily without installing:

```bash
pi -e npm:pi-auto-theme
```

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

```bash
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