Fix force transparent foreground colors to be opaque

This commit is contained in:
dennnnny
2023-08-13 17:52:49 +08:00
parent fb7349bc87
commit bef87403db
2 changed files with 3 additions and 2 deletions
+1 -1
View File
@@ -277,7 +277,7 @@ export class TextureAtlas implements ITextureAtlas {
} }
private _getBackgroundColor(bgColorMode: number, bgColor: number, inverse: boolean, dim: boolean): IColor { 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 // 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 // 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. // around the anti-aliased edges of the glyph, and it would look too dark.
+2 -1
View File
@@ -122,7 +122,8 @@ export class ThemeService extends Disposable implements IThemeService {
*/ */
private _setTheme(theme: ITheme = {}): void { private _setTheme(theme: ITheme = {}): void {
const colors = this._colors; 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.background = parseColor(theme.background, DEFAULT_BACKGROUND);
colors.cursor = parseColor(theme.cursor, DEFAULT_CURSOR); colors.cursor = parseColor(theme.cursor, DEFAULT_CURSOR);
colors.cursorAccent = parseColor(theme.cursorAccent, DEFAULT_CURSOR_ACCENT); colors.cursorAccent = parseColor(theme.cursorAccent, DEFAULT_CURSOR_ACCENT);