mirror of
https://github.com/Eugeny/tabby.git
synced 2026-08-24 10:14:31 -05:00
Fix OSC 11 background color reporting (#11074)
Co-authored-by: Eugene <inbox@null.page>
This commit is contained in:
@@ -6,7 +6,7 @@ export { TabRecoveryProvider, RecoveryToken } from './tabRecovery'
|
||||
export { ToolbarButtonProvider, ToolbarButton } from './toolbarButtonProvider'
|
||||
export { ConfigProvider } from './configProvider'
|
||||
export { HotkeyProvider, HotkeyDescription, Hotkey } from './hotkeyProvider'
|
||||
export { Theme } from './theme'
|
||||
export { Theme, TerminalColorScheme } from './theme'
|
||||
export { TabContextMenuItemProvider } from './tabContextMenuProvider'
|
||||
export { SelectorOption } from './selector'
|
||||
export { CLIHandler, CLIEvent } from './cli'
|
||||
|
||||
@@ -15,3 +15,14 @@ export abstract class Theme {
|
||||
macOSWindowButtonsInsetY?: number
|
||||
followsColorScheme?: boolean
|
||||
}
|
||||
|
||||
export interface TerminalColorScheme {
|
||||
name: string
|
||||
foreground: string
|
||||
background: string
|
||||
cursor: string
|
||||
colors: string[]
|
||||
selection?: string
|
||||
selectionForeground?: string
|
||||
cursorAccent?: string
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ import { Inject, Injectable } from '@angular/core'
|
||||
import { Subject, Observable } from 'rxjs'
|
||||
import * as Color from 'color'
|
||||
import { ConfigService } from '../services/config.service'
|
||||
import { Theme } from '../api/theme'
|
||||
import { TerminalColorScheme, Theme } from '../api/theme'
|
||||
import { PlatformService, PlatformTheme } from '../api/platform'
|
||||
import { NewTheme } from '../theme'
|
||||
|
||||
@@ -199,7 +199,7 @@ export class ThemesService {
|
||||
}
|
||||
|
||||
/// @hidden
|
||||
_getActiveColorScheme (): any {
|
||||
_getActiveColorScheme (): TerminalColorScheme {
|
||||
let theme: PlatformTheme = 'dark'
|
||||
if (this.getConfigStoreOrDefaults().appearance.colorSchemeMode === 'light') {
|
||||
theme = 'light'
|
||||
@@ -208,9 +208,9 @@ export class ThemesService {
|
||||
}
|
||||
|
||||
if (theme === 'light') {
|
||||
return this.getConfigStoreOrDefaults().terminal.lightColorScheme
|
||||
return this.getConfigStoreOrDefaults().terminal.lightColorScheme as TerminalColorScheme
|
||||
} else {
|
||||
return this.getConfigStoreOrDefaults().terminal.colorScheme
|
||||
return this.getConfigStoreOrDefaults().terminal.colorScheme as TerminalColorScheme
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { TerminalColorScheme } from './interfaces'
|
||||
import { TerminalColorScheme } from 'tabby-core'
|
||||
|
||||
/**
|
||||
* Extend to add more terminal color schemes
|
||||
|
||||
@@ -1,21 +1,10 @@
|
||||
import { ConnectableProfile, Profile } from 'tabby-core'
|
||||
import { ConnectableProfile, Profile, TerminalColorScheme } from 'tabby-core'
|
||||
|
||||
export interface ResizeEvent {
|
||||
columns: number
|
||||
rows: number
|
||||
}
|
||||
|
||||
export interface TerminalColorScheme {
|
||||
name: string
|
||||
foreground: string
|
||||
background: string
|
||||
cursor: string
|
||||
colors: string[]
|
||||
selection?: string
|
||||
selectionForeground?: string
|
||||
cursorAccent?: string
|
||||
}
|
||||
|
||||
export interface BaseTerminalProfile extends Profile {
|
||||
terminalColorScheme: TerminalColorScheme | null
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Injectable } from '@angular/core'
|
||||
import { TerminalColorScheme } from './api/interfaces'
|
||||
import { TerminalColorSchemeProvider } from './api/colorSchemeProvider'
|
||||
import { TerminalColorScheme } from 'tabby-core'
|
||||
|
||||
@Injectable({ providedIn: 'root' })
|
||||
export class DefaultColorSchemes extends TerminalColorSchemeProvider {
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { Component, Input, ChangeDetectionStrategy, ChangeDetectorRef } from '@angular/core'
|
||||
import { BaseComponent, ConfigService, getCSSFontFamily } from 'tabby-core'
|
||||
import { TerminalColorScheme } from '../api/interfaces'
|
||||
import { BaseComponent, ConfigService, getCSSFontFamily, TerminalColorScheme } from 'tabby-core'
|
||||
|
||||
/** @hidden */
|
||||
@Component({
|
||||
|
||||
@@ -2,9 +2,8 @@
|
||||
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker'
|
||||
|
||||
import { Component, Inject, Input, ChangeDetectionStrategy, ChangeDetectorRef, HostBinding, Output, EventEmitter } from '@angular/core'
|
||||
import { ConfigService } from 'tabby-core'
|
||||
import { ConfigService, TerminalColorScheme } from 'tabby-core'
|
||||
import { TerminalColorSchemeProvider } from '../api/colorSchemeProvider'
|
||||
import { TerminalColorScheme } from '../api/interfaces'
|
||||
|
||||
_('Search color schemes')
|
||||
|
||||
|
||||
@@ -3,9 +3,8 @@ import deepEqual from 'deep-equal'
|
||||
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker'
|
||||
|
||||
import { Component, Inject, Input, ChangeDetectionStrategy, ChangeDetectorRef, HostBinding } from '@angular/core'
|
||||
import { ConfigService, PlatformService, TranslateService } from 'tabby-core'
|
||||
import { ConfigService, PlatformService, TerminalColorScheme, TranslateService } from 'tabby-core'
|
||||
import { TerminalColorSchemeProvider } from '../api/colorSchemeProvider'
|
||||
import { TerminalColorScheme } from '../api/interfaces'
|
||||
|
||||
_('Search color schemes')
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import deepEqual from 'deep-equal'
|
||||
import { BehaviorSubject, filter, firstValueFrom, takeUntil } from 'rxjs'
|
||||
import { Injector } from '@angular/core'
|
||||
import { ConfigService, getCSSFontFamily, getWindows10Build, HostAppService, HotkeysService, Platform, PlatformService, ThemesService } from 'tabby-core'
|
||||
import { ConfigService, getCSSFontFamily, getWindows10Build, HostAppService, HotkeysService, Platform, PlatformService, TerminalColorScheme, ThemesService } from 'tabby-core'
|
||||
import { Frontend, SearchOptions, SearchState } from './frontend'
|
||||
import { Terminal, ITheme } from '@xterm/xterm'
|
||||
import { FitAddon } from '@xterm/addon-fit'
|
||||
@@ -12,7 +12,7 @@ import { Unicode11Addon } from '@xterm/addon-unicode11'
|
||||
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 { BaseTerminalProfile } from '../api/interfaces'
|
||||
import { getXtermBackgroundColor } from '../helpers'
|
||||
import { generatePalette } from '../generatePalette'
|
||||
import './xterm.css'
|
||||
@@ -455,7 +455,7 @@ export class XTermFrontend extends Frontend {
|
||||
}
|
||||
|
||||
private configureColors (scheme: TerminalColorScheme | null): void {
|
||||
const appColorScheme = this.themes._getActiveColorScheme() as TerminalColorScheme
|
||||
const appColorScheme = this.themes._getActiveColorScheme()
|
||||
|
||||
scheme = scheme ?? appColorScheme
|
||||
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
import { TerminalColorScheme } from './api/interfaces'
|
||||
import { ConfigService, ThemesService } from 'tabby-core'
|
||||
import { ConfigService, ThemesService, Theme, TerminalColorScheme } from 'tabby-core'
|
||||
|
||||
function getActiveTerminalTheme (
|
||||
themes: ThemesService,
|
||||
): { appTheme: ReturnType<ThemesService['findCurrentTheme']>, appColorScheme: TerminalColorScheme } {
|
||||
): { appTheme: Theme, appColorScheme: TerminalColorScheme } {
|
||||
const appTheme = themes.findCurrentTheme()
|
||||
const appColorScheme = themes._getActiveColorScheme() as TerminalColorScheme
|
||||
const appColorScheme = themes._getActiveColorScheme()
|
||||
|
||||
return { appTheme, appColorScheme }
|
||||
}
|
||||
|
||||
@@ -105,3 +105,4 @@ export * from './api/middleware'
|
||||
export * from './session'
|
||||
export { LoginScriptsSettingsComponent, StreamProcessingSettingsComponent }
|
||||
export { MultifocusService } from './services/multifocus.service'
|
||||
export { TerminalColorScheme } from 'tabby-core' // was previously defined in this plugin
|
||||
|
||||
Reference in New Issue
Block a user