Introduce is256Color helper

This commit is contained in:
Daniel Imms
2018-11-24 05:24:15 -08:00
parent 5fca73aa5a
commit c6f1de7970
5 changed files with 16 additions and 7 deletions
+2 -1
View File
@@ -7,6 +7,7 @@ import { DIM_OPACITY, IGlyphIdentifier, DEFAULT_COLOR } from './Types';
import { CHAR_ATLAS_CELL_SPACING, ICharAtlasConfig } from '../../shared/atlas/Types';
import { generateStaticCharAtlasTexture } from '../../shared/atlas/CharAtlasGenerator';
import BaseCharAtlas from './BaseCharAtlas';
import { is256Color } from './CharAtlasUtils';
export default class StaticCharAtlas extends BaseCharAtlas {
private _texture: HTMLCanvasElement | ImageBitmap;
@@ -58,7 +59,7 @@ export default class StaticCharAtlas extends BaseCharAtlas {
}
let colorIndex = 0;
if (glyph.fg < DEFAULT_COLOR) {
if (is256Color(glyph.fg)) {
colorIndex = 2 + glyph.fg + (glyph.bold ? 16 : 0);
} else if (glyph.fg === DEFAULT_COLOR) {
// If default color and bold