feat: update terminal theme without remounting the xterm instance

This commit is contained in:
Mohamed Boudra
2026-03-04 13:29:47 +07:00
parent 4f1783fc76
commit b21764fd40
3 changed files with 88 additions and 3 deletions
@@ -464,6 +464,30 @@ export class TerminalEmulatorRuntime {
this.fitAndEmitResize?.(input?.force ?? false);
}
setTheme(input: { theme: ITheme }): void {
const terminal = this.terminal;
if (!terminal) {
return;
}
try {
terminal.options.theme = input.theme;
terminalDebugLog({
scope: "emulator-runtime",
event: "theme:update",
});
} catch {
// ignore
return;
}
try {
terminal.refresh(0, Math.max(0, terminal.rows - 1));
} catch {
// ignore
}
}
focus(): void {
this.terminal?.focus();
}