Skip to content

Commit

Permalink
Add drawBoldTextInBrightColors option
Browse files Browse the repository at this point in the history
  • Loading branch information
LinusU committed Apr 23, 2018
1 parent 2f1ec3b commit 4d8b8fc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/renderer/BaseRenderLayer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,12 +248,13 @@ export abstract class BaseRenderLayer implements IRenderLayer {
const isBasicColor = fg < 16;
const isDefaultColor = fg >= 256;
const isDefaultBackground = bg >= 256;
const drawInBrightColor = (terminal.options.drawBoldTextInBrightColors !== false && bold && fg < 8);
if (this._charAtlas && isAscii && (isBasicColor || isDefaultColor) && isDefaultBackground) {
let colorIndex: number;
if (isDefaultColor) {
colorIndex = (bold && terminal.options.enableBold ? 1 : 0);
} 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
Expand All @@ -275,7 +276,7 @@ export abstract class BaseRenderLayer implements IRenderLayer {
charAtlasCellWidth,
this._scaledCharHeight);
} else {
this._drawUncachedChar(terminal, char, width, fg, x, y, bold && terminal.options.enableBold, dim);
this._drawUncachedChar(terminal, char, width, fg + (drawInBrightColor ? 8 : 0), x, y, bold && terminal.options.enableBold, dim);
}
// This draws the atlas (for debugging purposes)
// this._ctx.clearRect(0, 0, this._canvas.width, this._canvas.height);
Expand Down
5 changes: 5 additions & 0 deletions typings/xterm.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ declare module 'xterm' {
*/
disableStdin?: boolean;

/**
* Whether to draw bold text in bright colors. The default is true.
*/
drawBoldTextInBrightColors?: boolean;

/**
* Whether to enable the rendering of bold text.
*
Expand Down

0 comments on commit 4d8b8fc

Please sign in to comment.