本文整理匯總了TypeScript中xterm.Terminal.setOption方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Terminal.setOption方法的具體用法?TypeScript Terminal.setOption怎麽用?TypeScript Terminal.setOption使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類xterm.Terminal
的用法示例。
在下文中一共展示了Terminal.setOption方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: setTheme
export function setTheme(terminal: Terminal, theme_name: string): void {
let t = color_themes[theme_name];
if (t == null) {
t = color_themes["default"];
if (t == null) {
// can't happen
return;
}
}
const colors = t.colors;
if (colors == null) {
// satisfies typescript
return;
}
const theme: ITheme = {
background: colors[17],
foreground: colors[16],
cursor: colors[16],
cursorAccent: colors[17],
selection: "rgba(128, 128, 160, 0.25)",
black: colors[0],
red: colors[1],
green: colors[2],
yellow: colors[3],
blue: colors[4],
magenta: colors[5],
cyan: colors[6],
white: colors[7],
brightBlack: colors[8],
brightRed: colors[9],
brightGreen: colors[10],
brightYellow: colors[11],
brightBlue: colors[12],
brightMagenta: colors[13],
brightCyan: colors[14],
brightWhite: colors[15]
};
terminal.setOption("theme", theme);
}
示例2: Terminal
const r15: number = t.getOption('tabStopWidth');
const r16: number = t.getOption('scrollback');
const r18: (data: string) => void = t.getOption('handler');
const r19: string = t.getOption('bellSound');
const r20: string = t.getOption('bellStyle');
const r21: boolean = t.getOption('enableBold');
const r22: number = t.getOption('letterSpacing');
const r23: boolean = t.getOption('macOptionIsMeta');
const r24: string = t.getOption('fontWeight');
const r25: string = t.getOption('fontWeightBold');
const r26: boolean = t.getOption('allowTransparency');
const r27: boolean = t.getOption('rightClickSelectsWord');
}
{
const t: Terminal = new Terminal();
t.setOption('cursorStyle', 'bar');
t.setOption('cursorStyle', 'block');
t.setOption('cursorStyle', 'underline');
t.setOption('termName', 'foo');
t.setOption('cancelEvents', true);
t.setOption('convertEol', true);
t.setOption('cursorBlink', true);
t.setOption('debug', true);
t.setOption('disableStdin', true);
t.setOption('enableBold', true);
t.setOption('fontWeight', 'normal');
t.setOption('fontWeight', 'bold');
t.setOption('fontWeightBold', 'normal');
t.setOption('fontWeightBold', 'bold');
t.setOption('popOnBell', true);
t.setOption('screenKeys', true);
示例3:
Object.keys(updated).forEach(key => {
const value = updated[key];
term.setOption(key, value);
});