diff --git a/bash/.bash/prompt b/bash/.bash/prompt index 1201719..c11d73e 100644 --- a/bash/.bash/prompt +++ b/bash/.bash/prompt @@ -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" # ============================================================================ @@ -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}"'\]' diff --git a/ghostty/.config/ghostty/config b/ghostty/.config/ghostty/config index 40b7562..3177a33 100644 --- a/ghostty/.config/ghostty/config +++ b/ghostty/.config/ghostty/config @@ -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` diff --git a/pi/.pi/agent/packages/pi-minimal-prompt/README.md b/pi/.pi/agent/packages/pi-minimal-prompt/README.md index 95603c6..7852ed9 100644 --- a/pi/.pi/agent/packages/pi-minimal-prompt/README.md +++ b/pi/.pi/agent/packages/pi-minimal-prompt/README.md @@ -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. diff --git a/pi/.pi/agent/packages/pi-minimal-prompt/extensions/editor.ts b/pi/.pi/agent/packages/pi-minimal-prompt/extensions/editor.ts index 9a8fec5..5fd670c 100644 --- a/pi/.pi/agent/packages/pi-minimal-prompt/extensions/editor.ts +++ b/pi/.pi/agent/packages/pi-minimal-prompt/extensions/editor.ts @@ -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 { @@ -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; @@ -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, @@ -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, diff --git a/pi/.pi/agent/settings.json b/pi/.pi/agent/settings.json index 78e43c4..2f604ad 100644 --- a/pi/.pi/agent/settings.json +++ b/pi/.pi/agent/settings.json @@ -9,7 +9,7 @@ "./packages/pi-remote" ], "defaultThinkingLevel": "medium", - "theme": "dracula-plus", + "theme": "system", "hideThinkingBlock": true, "treeFilterMode": "no-tools", "outputPad": 0,