提交 111e6153 编写于 作者: D Daniel Imms

Support custom colors for ansi escape sequences

上级 fb71f044
......@@ -19,12 +19,28 @@ export const TERMINAL_DEFAULT_SHELL_WINDOWS = platform.isWindows ? path.resolve(
export var ITerminalService = createDecorator<ITerminalService>(TERMINAL_SERVICE_ID);
export interface ITerminalConfiguration {
terminal: {
integrated: {
shell: {
unixLike: string,
windows: string
}
integratedTerminal: {
shell: {
unixLike: string,
windows: string
},
ansiColors: {
black: string,
red: string,
green: string,
yellow: string,
blue: string,
magenta: string,
cyan: string,
white: string,
brightBlack: string,
brightRed: string,
brightGreen: string,
brightYellow: string,
brightBlue: string,
brightMagenta: string,
brightCyan: string,
brightWhite: string,
}
};
}
......
......@@ -24,14 +24,94 @@ configurationRegistry.registerConfiguration({
'type': 'object',
'properties': {
'integratedTerminal.shell.unixLike': {
'description': nls.localize('terminal.integrated.shell.unixLike', "The path of the shell that the terminal uses on Linux and OS X."),
'description': nls.localize('integratedTerminal.shell.unixLike', "The path of the shell that the terminal uses on Linux and OS X."),
'type': 'string',
'default': TERMINAL_DEFAULT_SHELL_UNIX_LIKE
},
'integratedTerminal.shell.windows': {
'description': nls.localize('terminal.integrated.shell.windows', "The path of the shell that the terminal uses on Windows."),
'description': nls.localize('integratedTerminal.shell.windows', "The path of the shell that the terminal uses on Windows."),
'type': 'string',
'default': TERMINAL_DEFAULT_SHELL_WINDOWS
},
'integratedTerminal.ansiColors.black': {
'description': nls.localize('integratedTerminal.ansiColors.black', "Black color for terminals that support ANSI escape sequences (format: #rrggbb)"),
'type': 'string',
'default': '#000000'
},
'integratedTerminal.ansiColors.red': {
'description': nls.localize('integratedTerminal.ansiColors.red', "Red color for terminals that support ANSI escape sequences (format: #rrggbb)"),
'type': 'string',
'default': '#cd3131'
},
'integratedTerminal.ansiColors.green': {
'description': nls.localize('integratedTerminal.ansiColors.green', "Green color for terminals that support ANSI escape sequences (format: #rrggbb)"),
'type': 'string',
'default': '#09885a'
},
'integratedTerminal.ansiColors.yellow': {
'description': nls.localize('integratedTerminal.ansiColors.yellow', "Yellow color for terminals that support ANSI escape sequences (format: #rrggbb)"),
'type': 'string',
'default': '#e5e510'
},
'integratedTerminal.ansiColors.blue': {
'description': nls.localize('integratedTerminal.ansiColors.blue', "Blue color for terminals that support ANSI escape sequences (format: #rrggbb)"),
'type': 'string',
'default': '#0451a5'
},
'integratedTerminal.ansiColors.magenta': {
'description': nls.localize('integratedTerminal.ansiColors.magenta', "Magenta color for terminals that support ANSI escape sequences (format: #rrggbb)"),
'type': 'string',
'default': '#bc05bc'
},
'integratedTerminal.ansiColors.cyan': {
'description': nls.localize('integratedTerminal.ansiColors.cyan', "Cyan color for terminals that support ANSI escape sequences (format: #rrggbb)"),
'type': 'string',
'default': '#0598bc'
},
'integratedTerminal.ansiColors.white': {
'description': nls.localize('integratedTerminal.ansiColors.white', "White color for terminals that support ANSI escape sequences (format: #rrggbb)"),
'type': 'string',
'default': '#e5e5e5'
},
'integratedTerminal.ansiColors.brightBlack': {
'description': nls.localize('integratedTerminal.ansiColors.brightBlack', "Bright black color for terminals that support ANSI escape sequences (format: #rrggbb)"),
'type': 'string',
'default': '#000000'
},
'integratedTerminal.ansiColors.brightRed': {
'description': nls.localize('integratedTerminal.ansiColors.brightRed', "Bright red color for terminals that support ANSI escape sequences (format: #rrggbb)"),
'type': 'string',
'default': '#cd3131'
},
'integratedTerminal.ansiColors.brightGreen': {
'description': nls.localize('integratedTerminal.ansiColors.brightGreen', "Bright green color for terminals that support ANSI escape sequences (format: #rrggbb)"),
'type': 'string',
'default': '#09885a'
},
'integratedTerminal.ansiColors.brightYellow': {
'description': nls.localize('integratedTerminal.ansiColors.brightYellow', "Bright yellow color for terminals that support ANSI escape sequences (format: #rrggbb)"),
'type': 'string',
'default': '#e5e510'
},
'integratedTerminal.ansiColors.brightBlue': {
'description': nls.localize('integratedTerminal.ansiColors.brightBlue', "Bright blue color for terminals that support ANSI escape sequences (format: #rrggbb)"),
'type': 'string',
'default': '#0451a5'
},
'integratedTerminal.ansiColors.brightMagenta': {
'description': nls.localize('integratedTerminal.ansiColors.brightMagenta', "Bright magenta color for terminals that support ANSI escape sequences (format: #rrggbb)"),
'type': 'string',
'default': '#bc05bc'
},
'integratedTerminal.ansiColors.brightCyan': {
'description': nls.localize('integratedTerminal.ansiColors.brightCyan', "Bright cyan color for terminals that support ANSI escape sequences (format: #rrggbb)"),
'type': 'string',
'default': '#0598bc'
},
'integratedTerminal.ansiColors.brightWhite': {
'description': nls.localize('integratedTerminal.ansiColors.brightWhite', "Bright white color for terminals that support ANSI escape sequences (format: #rrggbb)"),
'type': 'string',
'default': '#e5e5e5'
}
}
});
......
......@@ -68,24 +68,7 @@ export class TerminalPanel extends Panel {
this.parentDomElement.appendChild(terminalContainer.getDomNode());
this.terminalDomElement.style.fontFamily = 'Hack, mono';
this.terminal.colors = [
'#000000', // black
'#cd3131', // red
'#09885a', // green
'#e5e510', // yellow
'#0451a5', // blue
'#bc05bc', // magenta
'#0598bc', // cyan
'#e5e5e5', // white
'#111111', // bright black
'#dc6f6f', // bright red
'#53ac8c', // bright green
'#eded58', // bright yellow
'#4f85c0', // bright blue
'#d050d0', // bright magenta
'#50b7d0', // bright cyan
'#FFFFFF', // bright white
];
this.terminal.colors = this.getTerminalColors();
return TPromise.as(null);
}
......@@ -93,8 +76,31 @@ export class TerminalPanel extends Panel {
private getShell(): string {
let config = this.configurationService.getConfiguration<ITerminalConfiguration>();
if (platform.isWindows) {
return config.terminal.integrated.shell.windows;
return config.integratedTerminal.shell.windows;
}
return config.terminal.integrated.shell.unixLike;
return config.integratedTerminal.shell.unixLike;
}
private getTerminalColors(): string[] {
let config = this.configurationService.getConfiguration<ITerminalConfiguration>().integratedTerminal.ansiColors;
let colors = [
config.black || '#000000',
config.red || '#cd3131',
config.green || '#09885a',
config.yellow || '#e5e510',
config.blue || '#0451a5',
config.magenta || '#bc05bc',
config.cyan || '#0598bc',
config.white || '#e5e5e5',
config.brightBlack || '#111111',
config.brightRed || '#dc6f6f',
config.brightGreen || '#53ac8c',
config.brightYellow || '#eded58',
config.brightBlue || '#4f85c0',
config.brightMagenta || '#d050d0',
config.brightCyan || '#50b7d0',
config.brightWhite || '#FFFFFF'
];
return colors;
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册