Eugene Pankov 6 years ago
parent
commit
78f8f4005e

+ 3 - 3
terminus-core/src/theme.ts

@@ -5,19 +5,19 @@ import { Theme } from './api'
 export class StandardTheme extends Theme {
     name = 'Standard'
     css = require('./theme.scss')
-    terminalBackground = '#1D272D'
+    terminalBackground = '#222a33'
 }
 
 @Injectable()
 export class StandardCompactTheme extends Theme {
     name = 'Compact'
     css = require('./theme.compact.scss')
-    terminalBackground = '#1D272D'
+    terminalBackground = '#222a33'
 }
 
 @Injectable()
 export class PaperTheme extends Theme {
     name = 'Paper'
     css = require('./theme.paper.scss')
-    terminalBackground = '#1D272D'
+    terminalBackground = '#f7f1e0'
 }

+ 2 - 2
terminus-terminal/src/components/baseTerminalTab.component.ts

@@ -144,7 +144,7 @@ export class BaseTerminalTabComponent extends BaseTabComponent implements OnInit
             this.session.releaseInitialDataBuffer()
         })
 
-        this.frontend.configure(this.config.store)
+        this.frontend.configure()
         this.frontend.attach(this.content.nativeElement)
         this.attachTermContainerHandlers()
 
@@ -294,7 +294,7 @@ export class BaseTerminalTabComponent extends BaseTabComponent implements OnInit
     }
 
     configure (): void {
-        this.frontend.configure(this.config.store)
+        this.frontend.configure()
 
         if (this.config.store.terminal.background === 'colorScheme') {
             if (this.config.store.terminal.colorScheme.background) {

+ 5 - 1
terminus-terminal/src/frontends/frontend.ts

@@ -1,7 +1,11 @@
 import { Observable, Subject, AsyncSubject, ReplaySubject, BehaviorSubject } from 'rxjs'
 import { ResizeEvent } from '../api'
+import { ConfigService, ThemesService } from 'terminus-core'
 
 export abstract class Frontend {
+    configService: ConfigService
+    themesService: ThemesService
+
     enableResizing = true
     protected ready = new AsyncSubject<void>()
     protected title = new ReplaySubject<string>(1)
@@ -54,6 +58,6 @@ export abstract class Frontend {
     abstract visualBell (): void
     abstract scrollToBottom (): void
 
-    abstract configure (configStore: any): void
+    abstract configure (): void
     abstract setZoom (zoom: number): void
 }

+ 4 - 3
terminus-terminal/src/frontends/htermFrontend.ts

@@ -51,7 +51,9 @@ export class HTermFrontend extends Frontend {
         this.term.onVTKeystroke('\f')
     }
 
-    configure (config: any): void {
+    configure (): void {
+        let config = this.configService.store
+
         this.configuredFontSize = config.terminal.fontSize
         this.configuredLinePadding = config.terminal.linePadding
         this.setFontSize()
@@ -85,8 +87,7 @@ export class HTermFrontend extends Frontend {
                 preferenceManager.set('background-color', config.terminal.colorScheme.background)
             }
         } else {
-            // hterm can't parse "transparent"
-            preferenceManager.set('background-color', 'transparent')
+            preferenceManager.set('background-color', config.appearance.vibrancy ? 'transparent' : this.themesService.findCurrentTheme().terminalBackground)
         }
 
         this.configuredBackgroundColor = preferenceManager.get('background-color')

+ 4 - 2
terminus-terminal/src/frontends/xtermFrontend.ts

@@ -110,7 +110,9 @@ export class XTermFrontend extends Frontend {
         this.xtermCore._scrollToBottom()
     }
 
-    configure (config: any): void {
+    configure (): void {
+        let config = this.configService.store
+
         setTimeout(() => {
             if (this.xterm.cols && this.xterm.rows) {
                 this.resizeHandler()
@@ -131,7 +133,7 @@ export class XTermFrontend extends Frontend {
 
         let theme: ITheme = {
             foreground: config.terminal.colorScheme.foreground,
-            background: (config.terminal.background === 'colorScheme') ? config.terminal.colorScheme.background : 'transparent',
+            background: (config.terminal.background === 'colorScheme') ? config.terminal.colorScheme.background : (config.appearance.vibrancy ? 'transparent' : this.themesService.findCurrentTheme().terminalBackground),
             cursor: config.terminal.colorScheme.cursor,
         }
 

+ 6 - 3
terminus-terminal/src/services/terminalFrontend.service.ts

@@ -1,5 +1,5 @@
 import { Injectable } from '@angular/core'
-import { ConfigService } from 'terminus-core'
+import { ConfigService, ThemesService } from 'terminus-core'
 import { Frontend } from '../frontends/frontend'
 import { HTermFrontend } from '../frontends/htermFrontend'
 import { XTermFrontend } from '../frontends/xtermFrontend'
@@ -9,13 +9,16 @@ import { BaseSession } from '../services/sessions.service'
 export class TerminalFrontendService {
     private containers = new WeakMap<BaseSession, Frontend>()
 
-    constructor (private config: ConfigService) { }
+    constructor (private config: ConfigService, private themes: ThemesService) { }
 
     getFrontend (session?: BaseSession): Frontend {
         if (!session) {
-            return (this.config.store.terminal.frontend === 'xterm')
+            let frontend: Frontend = (this.config.store.terminal.frontend === 'xterm')
                 ? new XTermFrontend()
                 : new HTermFrontend()
+            frontend.configService = this.config
+            frontend.themesService = this.themes
+            return frontend
         }
         if (!this.containers.has(session)) {
             this.containers.set(