securityos/node_modules/xterm-addon-webgl/out/atlas/CharAtlasUtils.js

52 lines
1.8 KiB
JavaScript

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var Constants_1 = require("common/buffer/Constants");
var NULL_COLOR = {
css: '',
rgba: 0
};
function generateConfig(scaledCharWidth, scaledCharHeight, terminal, colors) {
var clonedColors = {
foreground: colors.foreground,
background: colors.background,
cursor: NULL_COLOR,
cursorAccent: NULL_COLOR,
selection: NULL_COLOR,
ansi: colors.ansi.slice()
};
return {
devicePixelRatio: window.devicePixelRatio,
scaledCharWidth: scaledCharWidth,
scaledCharHeight: scaledCharHeight,
fontFamily: terminal.getOption('fontFamily'),
fontSize: terminal.getOption('fontSize'),
fontWeight: terminal.getOption('fontWeight'),
fontWeightBold: terminal.getOption('fontWeightBold'),
allowTransparency: terminal.getOption('allowTransparency'),
colors: clonedColors
};
}
exports.generateConfig = generateConfig;
function configEquals(a, b) {
for (var i = 0; i < a.colors.ansi.length; i++) {
if (a.colors.ansi[i].rgba !== b.colors.ansi[i].rgba) {
return false;
}
}
return a.devicePixelRatio === b.devicePixelRatio &&
a.fontFamily === b.fontFamily &&
a.fontSize === b.fontSize &&
a.fontWeight === b.fontWeight &&
a.fontWeightBold === b.fontWeightBold &&
a.allowTransparency === b.allowTransparency &&
a.scaledCharWidth === b.scaledCharWidth &&
a.scaledCharHeight === b.scaledCharHeight &&
a.colors.foreground === b.colors.foreground &&
a.colors.background === b.colors.background;
}
exports.configEquals = configEquals;
function is256Color(colorCode) {
return colorCode < Constants_1.DEFAULT_COLOR;
}
exports.is256Color = is256Color;
//# sourceMappingURL=CharAtlasUtils.js.map