fix(coding-agent): load resume startup themes

This commit is contained in:
Armin Ronacher
2026-06-22 17:18:43 +02:00
parent 02540acd17
commit aa6bdd778a
7 changed files with 112 additions and 33 deletions
@@ -3,6 +3,7 @@ import type { SettingsManager } from "../../../core/settings-manager.ts";
import {
detectTerminalBackgroundFromEnv,
detectTerminalBackgroundTheme,
detectTerminalThemeForAuto,
initTheme,
parseAutoThemeSetting,
resolveThemeSetting,
@@ -37,7 +38,7 @@ export class InteractiveThemeController {
const themeSetting = this.settingsManager.getThemeSetting();
const autoTheme = parseAutoThemeSetting(themeSetting);
if (autoTheme) {
this.terminalTheme = await this.detectTerminalThemeForAuto();
this.terminalTheme = await detectTerminalThemeForAuto({ ui: this.ui, timeoutMs: 100 });
this.setAutoSync(true);
this.applyThemeName(this.terminalTheme === "light" ? autoTheme.lightTheme : autoTheme.darkTheme, true);
return;
@@ -109,16 +110,6 @@ export class InteractiveThemeController {
this.ui.setTerminalColorSchemeNotifications(enabled);
}
private async detectTerminalThemeForAuto(): Promise<TerminalTheme> {
try {
const colorScheme = await this.ui.queryTerminalColorScheme({ timeoutMs: 100 });
if (colorScheme) return colorScheme;
} catch {
// Fall back to OSC 11 / COLORFGBG detection when color-scheme DSR is unsupported.
}
return (await detectTerminalBackgroundTheme({ ui: this.ui, timeoutMs: 100 })).theme;
}
private applyTerminalTheme(terminalTheme: TerminalTheme): void {
if (!this.autoSyncEnabled) return;
this.terminalTheme = terminalTheme;