Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 18 additions & 9 deletions bash/.bash/prompt
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,22 @@ prompt_leading_padding() {
[[ -z "$VIRTUAL_ENV" || -z "$DIRENV_DIR" ]] && printf ' '
}

# Use Dracula+'s ANSI palette. A subtly lighter surface separates the prompt
# context segments from the terminal background.
BACKGROUND="\e[48;2;40;42;54m"
VENV_STYLE="${BACKGROUND}\e[38;5;1m" # red
GIT_STYLE="${BACKGROUND}\e[38;5;6m" # cyan
PATH_STYLE="${BACKGROUND}\e[38;5;15m" # foreground
PROMPT_FG="\e[1;38;5;15m" # foreground
# Match Ghostty's system appearance with a subtly filled context strip.
# macOS leaves AppleInterfaceStyle unset in light mode. Check once per prompt;
# other platforms retain the dark background without querying the terminal.
prompt_background() {
if [[ "$OSTYPE" == darwin* ]] && [[ "$(defaults read -g AppleInterfaceStyle 2>/dev/null)" != Dark ]]; then
printf '\e[48;2;230;233;239m' # Catppuccin Latte mantle (#e6e9ef)
else
printf '\e[48;2;40;42;54m' # Dracula gray (#282a36)
fi
}

# Foreground colors still follow the terminal's current palette.
VENV_STYLE="\e[31m" # red
GIT_STYLE="\e[36m" # cyan
PATH_STYLE="\e[39m" # default foreground
PROMPT_FG="\e[1;39m" # bold default foreground
RESET="\e[0m"

# ============================================================================
Expand All @@ -98,9 +107,9 @@ fi

# Variables must be outside single quotes so their escape sequences expand while
# the command substitutions remain dynamic for every prompt.
PS1='\['"${PATH_STYLE}"'\]$(prompt_leading_padding)'
PS1='\[$(prompt_background)'"${PATH_STYLE}"'\]$(prompt_leading_padding)'
PS1+='\['"${VENV_STYLE}"'\]$(prompt_venv)'
PS1+='\['"${GIT_STYLE}"'\]$(prompt_git_branch)'
PS1+='\['"${PATH_STYLE}"'\]\w\e[K'
PS1+='\['"${PATH_STYLE}"'\]\w\[\e[K\]'
PS1+='\['"${RESET}"'\]'
PS1+='\n\['"${PROMPT_FG}"'\] λ \['"${RESET}"'\]'
3 changes: 2 additions & 1 deletion ghostty/.config/ghostty/config
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@

# theme = Zenbones Dark
# theme = Carbonfox
theme = Dracula+
# Follow the system appearance, preserving Dracula+ in dark mode.
theme = light:Catppuccin Latte,dark:Dracula+

# Keep typography explicit so the terminal looks the same on every machine.
# On macOS: `brew install --cask font-iosevka`
Expand Down
4 changes: 3 additions & 1 deletion pi/.pi/agent/packages/pi-minimal-prompt/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,6 @@ Once published to npm:
pi install npm:pi-minimal-prompt
```

The package is designed for the Dracula+ theme and does not bundle it.
The prompt and status bar follow Pi's active theme. Set `"theme": "system"` in
`~/.pi/agent/settings.json` to follow the terminal palette, including live
light/dark appearance changes. No theme is bundled.
39 changes: 11 additions & 28 deletions pi/.pi/agent/packages/pi-minimal-prompt/extensions/editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,6 @@ import {
visibleWidth,
} from "@earendil-works/pi-tui";

// Dracula+ colors shared with the Bash prompt and Ghostty theme.
const STATUS_BACKGROUND = "\x1b[48;2;40;42;54m";
const STATUS_WHITE = "\x1b[38;2;248;248;242m";
const STATUS_RED = "\x1b[38;2;255;110;110m";
const STATUS_CYAN = "\x1b[38;2;139;233;253m";
const STATUS_GIT = "\x1b[38;5;6m";
const STATUS_MUTED = "\x1b[38;2;98;114;164m";
const HOME_DIRECTORY = homedir();

function displayPath(path: string): string {
Expand Down Expand Up @@ -50,17 +43,6 @@ function scrollLabel(line: string): string | undefined {
return stripAnsi(line).match(/([↑↓]\s+\d+\s+more)/)?.[1];
}

function statusForeground(color: string, text: string): string {
return `${color}${text}\x1b[39m`;
}

function statusBackground(text: string): string {
return `${STATUS_BACKGROUND}${text.replace(
/\x1b\[0m/g,
`\x1b[0m${STATUS_BACKGROUND}`,
)}\x1b[49m`;
}

function alignStatus(left: string, right: string, width: number): string {
let leftText = left;
let rightText = right;
Expand Down Expand Up @@ -106,29 +88,29 @@ class StatusEditor extends CustomEditor {
const usage = this.ctx.getContextUsage();
const context = usage ? `${Math.round(usage.percent)}%` : "";
const contextForeground = (usage?.percent ?? 0) >= 90
? STATUS_RED
: STATUS_WHITE;
? "error"
: "text";

const cost = this.ctx.sessionManager.getBranch().reduce((total, entry) => {
if (entry.type !== "message" || entry.message.role !== "assistant") return total;
return total + entry.message.usage.cost.total;
}, 0);
const delimiter = " ";
const modelLabel = statusForeground(
STATUS_WHITE,
const modelLabel = theme.fg(
"text",
thinking ? `${model} (${thinking})` : model,
);
const usageLabel = context ? statusForeground(contextForeground, context) : "";
const costLabel = statusForeground(contextForeground, `$${cost.toFixed(2)}`);
const usageLabel = context ? theme.fg(contextForeground, context) : "";
const costLabel = theme.fg(contextForeground, `$${cost.toFixed(2)}`);
const viewportLabel = [
scrollLabel(base[0] ?? ""),
scrollLabel(base[bottom] ?? ""),
].filter(Boolean).join(delimiter);
const gitBranch = this.getGitBranch();
const leftLabel = [
gitBranch ? statusForeground(STATUS_GIT, gitBranch) : "",
this.ctx.cwd ? statusForeground(STATUS_WHITE, displayPath(this.ctx.cwd)) : "",
viewportLabel ? statusForeground(STATUS_MUTED, viewportLabel) : "",
gitBranch ? theme.fg("accent", gitBranch) : "",
this.ctx.cwd ? theme.fg("text", displayPath(this.ctx.cwd)) : "",
viewportLabel ? theme.fg("dim", viewportLabel) : "",
].filter(Boolean).join(delimiter);
const rightLabel = [
modelLabel,
Expand All @@ -155,7 +137,8 @@ class StatusEditor extends CustomEditor {
const promptSpacer = theme.bg("userMessageBg", " ".repeat(width));

return [
statusBackground(status),
// Keep the status bar on the terminal's current background.
`\x1b[49m${status}`,
promptSpacer,
...promptLines,
...autocompleteLines,
Expand Down
2 changes: 1 addition & 1 deletion pi/.pi/agent/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"./packages/pi-remote"
],
"defaultThinkingLevel": "medium",
"theme": "dracula-plus",
"theme": "system",
"hideThinkingBlock": true,
"treeFilterMode": "no-tools",
"outputPad": 0,
Expand Down
Loading