diff --git a/terminus-core/src/api/index.ts b/terminus-core/src/api/index.ts index af554593..195ab8f5 100644 --- a/terminus-core/src/api/index.ts +++ b/terminus-core/src/api/index.ts @@ -13,3 +13,4 @@ export { ElectronService } from '../services/electron.service' export { Logger, LogService } from '../services/log.service' export { HotkeysService } from '../services/hotkeys.service' export { HostAppService, Platform } from '../services/hostApp.service' +export { ThemesService } from '../services/themes.service' diff --git a/terminus-core/src/services/themes.service.ts b/terminus-core/src/services/themes.service.ts index d9dd9a71..7207cd33 100644 --- a/terminus-core/src/services/themes.service.ts +++ b/terminus-core/src/services/themes.service.ts @@ -21,6 +21,10 @@ export class ThemesService { return this.themes.find(x => x.name === name) } + findCurrentTheme (): Theme { + return this.findTheme(this.config.store.appearance.theme) || this.findTheme('Standard') + } + applyTheme (theme: Theme): void { if (!this.styleElement) { this.styleElement = document.createElement('style') @@ -31,10 +35,6 @@ export class ThemesService { } applyCurrentTheme (): void { - let theme = this.findTheme(this.config.store.appearance.theme) - if (!theme) { - theme = this.findTheme('Standard') - } - this.applyTheme(theme) + this.applyTheme(this.findCurrentTheme()) } } diff --git a/terminus-terminal/src/components/terminalTab.component.ts b/terminus-terminal/src/components/terminalTab.component.ts index 676f00e3..65b4b565 100644 --- a/terminus-terminal/src/components/terminalTab.component.ts +++ b/terminus-terminal/src/components/terminalTab.component.ts @@ -1,6 +1,6 @@ import { BehaviorSubject, ReplaySubject, Subject, Subscription } from 'rxjs' import { Component, NgZone, Inject, ViewChild, HostBinding, Input } from '@angular/core' -import { AppService, ConfigService, BaseTabComponent } from 'terminus-core' +import { AppService, ConfigService, BaseTabComponent, ThemesService } from 'terminus-core' import { Session } from '../services/sessions.service' @@ -32,6 +32,7 @@ export class TerminalTabComponent extends BaseTabComponent { constructor( private zone: NgZone, private app: AppService, + private themes: ThemesService, public config: ConfigService, @Inject(TerminalDecorator) private decorators: TerminalDecorator[], ) { @@ -209,7 +210,7 @@ export class TerminalTabComponent extends BaseTabComponent { } else { this.backgroundColor = null // hterm can't parse "transparent" - preferenceManager.set('background-color', 'rgba(0,0,0,0)') + preferenceManager.set('background-color', themes.findCurrentTheme().terminalBackground) } if (config.terminal.colorScheme.colors) { preferenceManager.set('color-palette-overrides', config.terminal.colorScheme.colors)