From fb7349bc876bff1af46405f96cc02a3d61f0b524 Mon Sep 17 00:00:00 2001 From: dennnnny Date: Sat, 12 Aug 2023 08:39:39 +0800 Subject: [PATCH 1/3] Fix transparent foreground color --- src/browser/renderer/shared/TextureAtlas.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/browser/renderer/shared/TextureAtlas.ts b/src/browser/renderer/shared/TextureAtlas.ts index b73e700933..c50bda23ad 100644 --- a/src/browser/renderer/shared/TextureAtlas.ts +++ b/src/browser/renderer/shared/TextureAtlas.ts @@ -277,7 +277,7 @@ export class TextureAtlas implements ITextureAtlas { } private _getBackgroundColor(bgColorMode: number, bgColor: number, inverse: boolean, dim: boolean): IColor { - if (this._config.allowTransparency) { + if (this._config.allowTransparency || (inverse && !color.isOpaque(this._config.colors.foreground))) { // The background color might have some transparency, so we need to render it as fully // transparent in the atlas. Otherwise we'd end up drawing the transparent background twice // around the anti-aliased edges of the glyph, and it would look too dark. From bef87403db69831529bd7c55d494367c3298cdab Mon Sep 17 00:00:00 2001 From: dennnnny Date: Sun, 13 Aug 2023 17:52:49 +0800 Subject: [PATCH 2/3] Fix force transparent foreground colors to be opaque --- src/browser/renderer/shared/TextureAtlas.ts | 2 +- src/browser/services/ThemeService.ts | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/browser/renderer/shared/TextureAtlas.ts b/src/browser/renderer/shared/TextureAtlas.ts index c50bda23ad..b73e700933 100644 --- a/src/browser/renderer/shared/TextureAtlas.ts +++ b/src/browser/renderer/shared/TextureAtlas.ts @@ -277,7 +277,7 @@ export class TextureAtlas implements ITextureAtlas { } private _getBackgroundColor(bgColorMode: number, bgColor: number, inverse: boolean, dim: boolean): IColor { - if (this._config.allowTransparency || (inverse && !color.isOpaque(this._config.colors.foreground))) { + if (this._config.allowTransparency) { // The background color might have some transparency, so we need to render it as fully // transparent in the atlas. Otherwise we'd end up drawing the transparent background twice // around the anti-aliased edges of the glyph, and it would look too dark. diff --git a/src/browser/services/ThemeService.ts b/src/browser/services/ThemeService.ts index 2411ce8502..91a72f5e0e 100644 --- a/src/browser/services/ThemeService.ts +++ b/src/browser/services/ThemeService.ts @@ -122,7 +122,8 @@ export class ThemeService extends Disposable implements IThemeService { */ private _setTheme(theme: ITheme = {}): void { const colors = this._colors; - colors.foreground = parseColor(theme.foreground, DEFAULT_FOREGROUND); + colors.foreground = color.opaque(parseColor(theme.foreground, DEFAULT_FOREGROUND)); + console.warn("xterm.js is not fully support foreground colors with transparent, so it will the foreground colors alpha channel to 255.") colors.background = parseColor(theme.background, DEFAULT_BACKGROUND); colors.cursor = parseColor(theme.cursor, DEFAULT_CURSOR); colors.cursorAccent = parseColor(theme.cursorAccent, DEFAULT_CURSOR_ACCENT); From 855e9113983bb6bfa60e4316042f727beb32ce5c Mon Sep 17 00:00:00 2001 From: dennnnny Date: Mon, 14 Aug 2023 09:49:18 +0800 Subject: [PATCH 3/3] Fix transparent foreground color --- src/browser/renderer/shared/TextureAtlas.ts | 2 +- src/browser/services/ThemeService.ts | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/browser/renderer/shared/TextureAtlas.ts b/src/browser/renderer/shared/TextureAtlas.ts index b73e700933..54171008af 100644 --- a/src/browser/renderer/shared/TextureAtlas.ts +++ b/src/browser/renderer/shared/TextureAtlas.ts @@ -298,7 +298,7 @@ export class TextureAtlas implements ITextureAtlas { case Attributes.CM_DEFAULT: default: if (inverse) { - result = this._config.colors.foreground; + result = color.opaque(this._config.colors.foreground); } else { result = this._config.colors.background; } diff --git a/src/browser/services/ThemeService.ts b/src/browser/services/ThemeService.ts index 91a72f5e0e..2411ce8502 100644 --- a/src/browser/services/ThemeService.ts +++ b/src/browser/services/ThemeService.ts @@ -122,8 +122,7 @@ export class ThemeService extends Disposable implements IThemeService { */ private _setTheme(theme: ITheme = {}): void { const colors = this._colors; - colors.foreground = color.opaque(parseColor(theme.foreground, DEFAULT_FOREGROUND)); - console.warn("xterm.js is not fully support foreground colors with transparent, so it will the foreground colors alpha channel to 255.") + colors.foreground = parseColor(theme.foreground, DEFAULT_FOREGROUND); colors.background = parseColor(theme.background, DEFAULT_BACKGROUND); colors.cursor = parseColor(theme.cursor, DEFAULT_CURSOR); colors.cursorAccent = parseColor(theme.cursorAccent, DEFAULT_CURSOR_ACCENT);