Pi Agent Theme Customization

Pi Agent supports customizing terminal interface colors.

This chapter covers how to use built-in themes and create custom themes.


Theme Overview

Pi Agent uses JSON-format theme files to define all colors in the TUI interface.

Each theme needs to define51 required tokens + 4 optional tokens (thinkingMax, scrollbarThumb, searchMatchBg, searchMatchText), covering colors for various interface elements such as core UI, message backgrounds, Markdown rendering, syntax highlighting, and editor borders.


Built-in Themes

Pi Agent ships with two built-in themes:

Theme NameApplicable ScenarioDescription
darkDark terminal background (default)Suitable for dark terminals used by most developers
lightLight terminal backgroundSuitable for terminals with light themes

On first launch, Pi Agent automatically detects your terminal background color and selects dark or light.

In interactive mode, type /settings and switch directly in the theme options:

/settings

You can also write the theme field in settings.json and change the value of theme to the theme name:

Example

{
  "theme": "light"
}

Creating Custom Themes

First, create the theme directory and file:

mkdir -p ~/.pi/agent/themes
vim ~/.pi/agent/themes/my-theme.json

Then define the theme file. The following is a complete custom theme example:

Example

{
  "name": "my-theme",
  "vars": {
    "blue": "#0066cc",
    "gray": 242,
    "orange": "#ffaa00",
    "green": "#0055AA"
  },
  "colors": {
    "accent": "blue",
    "border": "blue",
    "borderAccent": "#00ffff",
    "borderMuted": "gray",
    "success": "green",
    "error": "#ff0000",
    "warning": "#ffff00",
    "muted": "gray",
    "dim": 240,
    "text": "",
    "thinkingText": "gray",
    "selectedBg": "#2d2d30",
    "userMessageBg": "#2d2d30",
    "userMessageText": "",
    "customMessageBg": "#2d2d30",
    "customMessageText": "",
    "customMessageLabel": "blue",
    "toolPendingBg": "#1e1e2e",
    "toolSuccessBg": "#1e2e1e",
    "toolErrorBg": "#2e1e1e",
    "toolTitle": "blue",
    "toolOutput": "",
    "mdHeading": "orange",
    "mdLink": "blue",
    "mdLinkUrl": "gray",
    "mdCode": "#00ffff",
    "mdCodeBlock": "",
    "mdCodeBlockBorder": "gray",
    "mdQuote": "gray",
    "mdQuoteBorder": "gray",
    "mdHr": "gray",
    "mdListBullet": "#00ffff",
    "toolDiffAdded": "green",
    "toolDiffRemoved": "#ff0000",
    "toolDiffContext": "gray",
    "syntaxComment": "gray",
    "syntaxKeyword": "blue",
    "syntaxFunction": "#00aaff",
    "syntaxVariable": "orange",
    "syntaxString": "green",
    "syntaxNumber": "#ff00ff",
    "syntaxType": "#00aaff",
    "syntaxOperator": "blue",
    "syntaxPunctuation": "gray",
    "thinkingOff": "gray",
    "thinkingMinimal": "blue",
    "thinkingLow": "#00aaff",
    "thinkingMedium": "#00ffff",
    "thinkingHigh": "#ff00ff",
    "thinkingXhigh": "#ff0000",
    "thinkingMax": "#ff0088",
    "bashMode": "orange"
  }
}

Then enable your theme in settings.json:

Example

{
  "theme": "my-theme"
}

When you edit the custom theme file currently in use, Pi Agent automatically hot-reloads the theme, letting you see changes immediately without any action.


Theme File Loading Locations

Pi Agent looks for theme files in the following locations.

Themes placed in different locations have different visibility scopes and loading conditions.

LocationScope
Built-indark, light always available
~/.pi/agent/themes/*.jsonGlobal themes, available to all projects
.pi/themes/*.jsonProject themes, loaded only after the project is trusted
Pi Packagesthemes/ directory in the package
--theme pathTemporarily loaded via command line

Color Value Formats

Pi Agent supports four color value formats:

FormatExampleDescription
Hex color"#ff0000"6-digit hexadecimal RGB color
256-color palette39xterm 256-color palette index (0-255)
Variable reference"blue"References a variable defined in vars
Terminal default color""Uses the terminal's default foreground/background color

The vars section is used to define reusable color variables, referenced by name in colors.

After extracting the primary colors into variables, changing the color scheme only requires editing one place, making theme maintenance easier.


Color Token Categories

Each token in colors corresponds to the color of a category of elements in the interface.

Below, all tokens are divided into six categories by purpose for easy reference.

Core UI (11)

This group controls the colors of basic interface elements such as the editor and status bar.

TokenPurpose
accentPrimary color (Logo, selected items, cursor)
borderNormal border
borderAccentHighlight border
borderMutedSoft border for the editor area
successSuccess status
errorError status
warningWarning status
mutedSecondary text
dimTertiary text (even less prominent)
textDefault text color (usually left empty)
thinkingTextAI reasoning process text

Background & Content (11 required + 3 optional)

This group controls the background and text of selected items, message bubbles, and tool output areas.

TokenPurpose
selectedBgSelected item background (current entry in the list)
userMessageBgUser message background
userMessageTextUser message text
customMessageBgExpanded message background
customMessageTextExpanded message text
customMessageLabelTitle tag color for expanded messages
toolPendingBgTool executing background
toolSuccessBgTool execution success background
toolErrorBgTool execution failure background
toolTitleTool card title text
toolOutputTool output text
scrollbarThumbFullscreen scrollbar thumb color (optional, falls back to selectedBg if not defined)
searchMatchBgSearch match background (optional, falls back to selectedBg if not defined)
searchMatchTextSearch match text (optional, falls back to text if not defined)

Markdown Rendering (10)

This group controls the colors of Markdown elements in AI replies.

TokenPurpose
mdHeadingHeading
mdLinkLink text
mdLinkUrlLink URL address
mdCodeInline code
mdCodeBlockCode block content
mdCodeBlockBorderCode block border
mdQuoteBlockquote text
mdQuoteBorderBlockquote border
mdHrDivider
mdListBulletList marker

Syntax Highlighting (9)

This group controls the syntax highlighting colors within code blocks.

TokenPurpose
syntaxCommentComment
syntaxKeywordKeyword
syntaxFunctionFunction name
syntaxVariableVariable name
syntaxStringString
syntaxNumberNumber
syntaxTypeType
syntaxOperatorOperator
syntaxPunctuationPunctuation

Reasoning Level Borders (7)

This group controls the indicator color of the current reasoning level on the editor border.

TokenCorresponding Level
thinkingOffReasoning off
thinkingMinimalMinimum reasoning
thinkingLowLow reasoning
thinkingMediumMedium reasoning
thinkingHighHigh reasoning
thinkingXhighExtra-high reasoning
thinkingMaxMaximum reasoning (optional)

thinkingMax is an optional token. If not defined, it falls back to the thinkingXhigh color.

Diff & Bash Colors (4)

This group controls diff highlighting and bash mode prompt colors — the ones you see most often when editing code.

TokenPurpose
toolDiffAddeddiff added lines (usually green)
toolDiffRemoveddiff removed lines (usually red)
toolDiffContextdiff context lines (keep subtle)
bashModePrompt color in bash mode

HTML Export Colors

If you use /export to export a session as HTML, you can define colors for the exported page in the theme:

Example

{
  "export": {
    "pageBg": "#18181e",
    "cardBg": "#1e1e24",
    "infoBg": "#3c3728"
  }
}

If the export configuration is omitted, the exported page automatically derives colors from userMessageBg.


Theme Creation Tips

The following tips will help your custom theme behave consistently across different terminals.

  • Dark terminals: Use bright, saturated colors with sufficiently high contrast
  • Light terminals: Use deeper, softer colors; contrast can be lowered appropriately
  • Color harmony: Reference mature color schemes such as Nord, Gruvbox, and Tokyo Night as a foundation
  • Test thoroughlyEnsure proper display across different message types, tool states, Markdown content, and long text wrapping
Other Extensions