Use the proper bg/fg colors for inverse attr

This commit is contained in:
Daniel Imms
2017-09-01 21:09:07 -07:00
parent 1f444b1913
commit 70764a74af
3 changed files with 13 additions and 10 deletions
+7 -3
View File
@@ -2,6 +2,8 @@ import { IRenderLayer, IColorSet } from './Interfaces';
import { ITerminal, ITerminalOptions } from '../Interfaces';
import { acquireCharAtlas } from '../utils/CharAtlas';
export const INVERTED_DEFAULT_COLOR = -1;
export abstract class BaseRenderLayer implements IRenderLayer {
private _canvas: HTMLCanvasElement;
protected _ctx: CanvasRenderingContext2D;
@@ -102,11 +104,13 @@ export abstract class BaseRenderLayer implements IRenderLayer {
this._ctx.font = `${terminal.options.fontSize * window.devicePixelRatio}px ${terminal.options.fontFamily}`;
this._ctx.textBaseline = 'top';
// 256 color support
if (fg < 256) {
if (fg === INVERTED_DEFAULT_COLOR) {
this._ctx.fillStyle = this.colors.background;
} else if (fg < 256) {
// 256 color support
this._ctx.fillStyle = this.colors.ansi[fg];
} else {
this._ctx.fillStyle = '#ffffff';
this._ctx.fillStyle = this.colors.foreground;
}
// TODO: Do we care about width for rendering wide chars?