Merge pull request #3 from juancampa/selection-simple-webgl2

Use bg luminance to determine background color
This commit is contained in:
Daniel Imms
2019-01-19 09:35:25 -08:00
committed by GitHub
4 changed files with 24 additions and 5 deletions
+5 -3
View File
@@ -4,7 +4,7 @@
*/
import { createProgram, PROJECTION_MATRIX } from './WebglUtils';
import { IRenderDimensions } from '../Types';
import { IColorManager, IRenderDimensions } from '../Types';
import { ITerminal, IBufferLine } from '../../Types';
import { NULL_CELL_CODE, CHAR_DATA_CHAR_INDEX, WHITESPACE_CELL_CODE } from '../../Buffer';
import WebglCharAtlas from './WebglCharAtlas';
@@ -95,6 +95,7 @@ export class GlyphRenderer {
constructor(
private _terminal: ITerminal,
private _colorManager: IColorManager,
private _gl: IWebGL2RenderingContext,
private _dimensions: IRenderDimensions
) {
@@ -214,8 +215,9 @@ export class GlyphRenderer {
// TODO: Make fg and bg configurable, currently since the buffer doesn't
// support truecolor the char atlas cannot store it.
const fg = 0;
const bg = 7;
const lumi = this._colorManager.getLuminance(this._colorManager.colors.background)
const fg = lumi > 0.5 ? 7 : 0;
const bg = lumi > 0.5 ? 0 : 7;
if (columnSelectMode) {
const startCol = model.selection.startCol;
+1 -1
View File
@@ -90,7 +90,7 @@ export class WebglRenderer extends EventEmitter implements IRenderer {
this._terminal.screenElement.appendChild(this._canvas);
this._rectangleRenderer = new RectangleRenderer(this._terminal, this.colorManager, this._gl, this.dimensions);
this._glyphRenderer = new GlyphRenderer(this._terminal, this._gl, this.dimensions);
this._glyphRenderer = new GlyphRenderer(this._terminal, this.colorManager, this._gl, this.dimensions);
// Detect whether IntersectionObserver is detected and enable renderer pause
// and resume based on terminal visibility if so