Add drawBoldTextInBrightColors option
This commit is contained in:
@@ -248,12 +248,13 @@ export abstract class BaseRenderLayer implements IRenderLayer {
|
|||||||
const isBasicColor = fg < 16;
|
const isBasicColor = fg < 16;
|
||||||
const isDefaultColor = fg >= 256;
|
const isDefaultColor = fg >= 256;
|
||||||
const isDefaultBackground = bg >= 256;
|
const isDefaultBackground = bg >= 256;
|
||||||
|
const drawInBrightColor = (terminal.options.drawBoldTextInBrightColors !== false && bold && fg < 8);
|
||||||
if (this._charAtlas && isAscii && (isBasicColor || isDefaultColor) && isDefaultBackground && !italic) {
|
if (this._charAtlas && isAscii && (isBasicColor || isDefaultColor) && isDefaultBackground && !italic) {
|
||||||
let colorIndex: number;
|
let colorIndex: number;
|
||||||
if (isDefaultColor) {
|
if (isDefaultColor) {
|
||||||
colorIndex = (bold && terminal.options.enableBold ? 1 : 0);
|
colorIndex = (bold && terminal.options.enableBold ? 1 : 0);
|
||||||
} else {
|
} else {
|
||||||
colorIndex = 2 + fg + (bold && terminal.options.enableBold ? 16 : 0);
|
colorIndex = 2 + fg + (bold && terminal.options.enableBold ? 16 : 0) + (drawInBrightColor ? 8 : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ImageBitmap's draw about twice as fast as from a canvas
|
// ImageBitmap's draw about twice as fast as from a canvas
|
||||||
@@ -275,7 +276,7 @@ export abstract class BaseRenderLayer implements IRenderLayer {
|
|||||||
charAtlasCellWidth,
|
charAtlasCellWidth,
|
||||||
this._scaledCharHeight);
|
this._scaledCharHeight);
|
||||||
} else {
|
} else {
|
||||||
this._drawUncachedChar(terminal, char, width, fg, x, y, bold && terminal.options.enableBold, dim, italic);
|
this._drawUncachedChar(terminal, char, width, fg + (drawInBrightColor ? 8 : 0), x, y, bold && terminal.options.enableBold, dim, italic);
|
||||||
}
|
}
|
||||||
// This draws the atlas (for debugging purposes)
|
// This draws the atlas (for debugging purposes)
|
||||||
// this._ctx.clearRect(0, 0, this._canvas.width, this._canvas.height);
|
// this._ctx.clearRect(0, 0, this._canvas.width, this._canvas.height);
|
||||||
|
|||||||
Vendored
+5
@@ -54,6 +54,11 @@ declare module 'xterm' {
|
|||||||
*/
|
*/
|
||||||
disableStdin?: boolean;
|
disableStdin?: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether to draw bold text in bright colors. The default is true.
|
||||||
|
*/
|
||||||
|
drawBoldTextInBrightColors?: boolean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether to enable the rendering of bold text.
|
* Whether to enable the rendering of bold text.
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user