Organize temporary color handling code

This commit is contained in:
Daniel Imms
2017-09-02 11:08:43 -07:00
parent ee4b71c8e7
commit 9cabb93b8b
4 changed files with 95 additions and 123 deletions
+4 -1
View File
@@ -128,7 +128,10 @@ export abstract class BaseRenderLayer implements IRenderLayer {
if (fg < 256) {
colorIndex = fg + 1;
}
if (code < 256 && (colorIndex > 0 || fg >= 256)) {
const isAscii = code < 256;
const isBasicColor = (colorIndex > 0 && fg < 16);
const isDefaultColor = fg >= 256;
if (isAscii && (isBasicColor || isDefaultColor)) {
// ImageBitmap's draw about twice as fast as from a canvas
const charAtlasCellWidth = this.scaledCharWidth + CHAR_ATLAS_CELL_SPACING;
const charAtlasCellHeight = this.scaledCharHeight + CHAR_ATLAS_CELL_SPACING;
+1 -1
View File
@@ -23,7 +23,7 @@ export enum COLOR_CODES {
BRIGHT_WHITE = 15
}
const DEFAULT_ANSI_COLORS = [
export const DEFAULT_ANSI_COLORS = [
// dark:
'#2e3436',
'#cc0000',
-1
View File
@@ -101,7 +101,6 @@ export class ForegroundRenderLayer extends BaseRenderLayer {
}
const width: number = charData[CHAR_DATA_WIDTH_INDEX];
this.drawChar(terminal, char, code, width, x, y, fg);
this._ctx.restore();