diff --git a/src/browser/Types.d.ts b/src/browser/Types.d.ts index c91673164..3f3a76376 100644 --- a/src/browser/Types.d.ts +++ b/src/browser/Types.d.ts @@ -24,6 +24,15 @@ export interface IColorSet { ansi: IColor[]; } +export interface IPartialColorSet { + foreground: IColor; + background: IColor; + cursor?: IColor; + cursorAccent?: IColor; + selection?: IColor; + ansi: IColor[]; +} + export interface IViewport extends IDisposable { scrollBarWidth: number; syncScrollArea(): void; diff --git a/src/renderer/atlas/CharAtlasUtils.ts b/src/browser/renderer/atlas/CharAtlasUtils.ts similarity index 73% rename from src/renderer/atlas/CharAtlasUtils.ts rename to src/browser/renderer/atlas/CharAtlasUtils.ts index da067f520..346b35f8e 100644 --- a/src/renderer/atlas/CharAtlasUtils.ts +++ b/src/browser/renderer/atlas/CharAtlasUtils.ts @@ -3,19 +3,19 @@ * @license MIT */ -import { ITerminal } from '../../Types'; import { ICharAtlasConfig } from 'browser/renderer/atlas/Types'; import { DEFAULT_COLOR } from 'common/buffer/Constants'; -import { IColorSet } from 'browser/Types'; +import { IColorSet, IPartialColorSet } from 'browser/Types'; +import { ITerminalOptions } from 'common/services/Services'; -export function generateConfig(scaledCharWidth: number, scaledCharHeight: number, terminal: ITerminal, colors: IColorSet): ICharAtlasConfig { +export function generateConfig(scaledCharWidth: number, scaledCharHeight: number, options: ITerminalOptions, colors: IColorSet): ICharAtlasConfig { // null out some fields that don't matter - const clonedColors = { + const clonedColors = { foreground: colors.foreground, background: colors.background, - cursor: null, - cursorAccent: null, - selection: null, + cursor: undefined, + cursorAccent: undefined, + selection: undefined, // For the static char atlas, we only use the first 16 colors, but we need all 256 for the // dynamic character atlas. ansi: colors.ansi.slice(0, 16) @@ -24,11 +24,11 @@ export function generateConfig(scaledCharWidth: number, scaledCharHeight: number devicePixelRatio: window.devicePixelRatio, scaledCharWidth, scaledCharHeight, - fontFamily: terminal.options.fontFamily, - fontSize: terminal.options.fontSize, - fontWeight: terminal.options.fontWeight, - fontWeightBold: terminal.options.fontWeightBold, - allowTransparency: terminal.options.allowTransparency, + fontFamily: options.fontFamily, + fontSize: options.fontSize, + fontWeight: options.fontWeight, + fontWeightBold: options.fontWeightBold, + allowTransparency: options.allowTransparency, colors: clonedColors }; } diff --git a/src/browser/renderer/atlas/Types.d.ts b/src/browser/renderer/atlas/Types.d.ts index 0724b163f..d8bc54c19 100644 --- a/src/browser/renderer/atlas/Types.d.ts +++ b/src/browser/renderer/atlas/Types.d.ts @@ -4,7 +4,7 @@ */ import { FontWeight } from 'common/services/Services'; -import { IColorSet } from 'browser/Types'; +import { IPartialColorSet } from 'browser/Types'; export interface IGlyphIdentifier { chars: string; @@ -25,5 +25,5 @@ export interface ICharAtlasConfig { scaledCharWidth: number; scaledCharHeight: number; allowTransparency: boolean; - colors: IColorSet; + colors: IPartialColorSet; } diff --git a/src/renderer/LinkRenderLayer.ts b/src/renderer/LinkRenderLayer.ts index 6e6ba2e4f..f4fb966aa 100644 --- a/src/renderer/LinkRenderLayer.ts +++ b/src/renderer/LinkRenderLayer.ts @@ -7,7 +7,7 @@ import { ITerminal, ILinkifierAccessor } from '../Types'; import { IRenderDimensions } from 'browser/renderer/Types'; import { BaseRenderLayer } from './BaseRenderLayer'; import { INVERTED_DEFAULT_COLOR } from 'browser/renderer/atlas/Constants'; -import { is256Color } from './atlas/CharAtlasUtils'; +import { is256Color } from 'browser/renderer/atlas/CharAtlasUtils'; import { IColorSet, ILinkifierEvent } from 'browser/Types'; export class LinkRenderLayer extends BaseRenderLayer { diff --git a/src/renderer/atlas/CharAtlasCache.ts b/src/renderer/atlas/CharAtlasCache.ts index ec66b67a7..ccc4437c2 100644 --- a/src/renderer/atlas/CharAtlasCache.ts +++ b/src/renderer/atlas/CharAtlasCache.ts @@ -4,9 +4,9 @@ */ import { ITerminal } from '../../Types'; -import { generateConfig, configEquals } from './CharAtlasUtils'; +import { generateConfig, configEquals } from 'browser/renderer/atlas/CharAtlasUtils'; import { BaseCharAtlas } from 'browser/renderer/atlas/BaseCharAtlas'; -import { DynamicCharAtlas } from '../../browser/renderer/atlas/DynamicCharAtlas'; +import { DynamicCharAtlas } from 'browser/renderer/atlas/DynamicCharAtlas'; import { ICharAtlasConfig } from 'browser/renderer/atlas/Types'; import { IColorSet } from 'browser/Types'; @@ -32,7 +32,7 @@ export function acquireCharAtlas( scaledCharWidth: number, scaledCharHeight: number ): BaseCharAtlas { - const newConfig = generateConfig(scaledCharWidth, scaledCharHeight, terminal, colors); + const newConfig = generateConfig(scaledCharWidth, scaledCharHeight, terminal.optionsService.options, colors); // Check to see if the terminal already owns this config for (let i = 0; i < charAtlasCache.length; i++) {