This commit is contained in:
Eugene Pankov 2017-04-20 22:00:21 +02:00
parent e6310a17f8
commit d909c4a791
3 changed files with 9 additions and 7 deletions

View File

@ -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'

View File

@ -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())
}
}

View File

@ -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)