diff --git a/tabby-terminal/src/frontends/xtermFrontend.ts b/tabby-terminal/src/frontends/xtermFrontend.ts index a96d468388..c8243fe3bb 100644 --- a/tabby-terminal/src/frontends/xtermFrontend.ts +++ b/tabby-terminal/src/frontends/xtermFrontend.ts @@ -14,7 +14,7 @@ import { SerializeAddon } from '@xterm/addon-serialize' import { ImageAddon } from '@xterm/addon-image' import { CanvasAddon } from '@xterm/addon-canvas' import { BaseTerminalProfile, TerminalColorScheme } from '../api/interfaces' -import { getTerminalBackgroundColor } from '../helpers' +import { getXtermBackgroundColor } from '../helpers' import './xterm.css' const COLOR_NAMES = [ @@ -394,7 +394,7 @@ export class XTermFrontend extends Frontend { foreground: scheme.foreground, selectionBackground: scheme.selection ?? '#88888888', selectionForeground: scheme.selectionForeground ?? undefined, - background: getTerminalBackgroundColor(this.configService, this.themes, scheme) ?? '#00000000', + background: getXtermBackgroundColor(this.configService, this.themes, scheme), cursor: scheme.cursor, cursorAccent: scheme.cursorAccent, overviewRulerBorder: scheme.background, diff --git a/tabby-terminal/src/helpers.ts b/tabby-terminal/src/helpers.ts index ebfd255369..8e1d57122c 100644 --- a/tabby-terminal/src/helpers.ts +++ b/tabby-terminal/src/helpers.ts @@ -1,13 +1,21 @@ import { TerminalColorScheme } from './api/interfaces' import { ConfigService, ThemesService } from 'tabby-core' +function getActiveTerminalTheme ( + themes: ThemesService, +): { appTheme: ReturnType, appColorScheme: TerminalColorScheme } { + const appTheme = themes.findCurrentTheme() + const appColorScheme = themes._getActiveColorScheme() as TerminalColorScheme + + return { appTheme, appColorScheme } +} + export function getTerminalBackgroundColor ( config: ConfigService, themes: ThemesService, scheme: TerminalColorScheme | null, ): string|null { - const appTheme = themes.findCurrentTheme() - const appColorScheme = themes._getActiveColorScheme() as TerminalColorScheme + const { appTheme, appColorScheme } = getActiveTerminalTheme(themes) // Use non transparent background when: // - legacy theme and user choses colorScheme based BG @@ -19,3 +27,17 @@ export function getTerminalBackgroundColor ( return shouldUseCSBackground && scheme ? scheme.background : null } + +export function getXtermBackgroundColor ( + config: ConfigService, + themes: ThemesService, + scheme: TerminalColorScheme | null, +): string { + const configuredBackground = getTerminalBackgroundColor(config, themes, scheme) + if (configuredBackground) { + return configuredBackground + } + + const { appTheme, appColorScheme } = getActiveTerminalTheme(themes) + return appTheme.followsColorScheme ? appColorScheme.background : appTheme.terminalBackground +}