Skip to content

Commit

Permalink
Add terminal.selectionBackground theme key
Browse files Browse the repository at this point in the history
Fixes #28397
  • Loading branch information
Tyriar committed Jun 18, 2017
1 parent 2303df3 commit 435f1ef
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -140,14 +140,6 @@

.monaco-workbench .panel.integrated-terminal .xterm .xterm-selection div {
position: absolute;
opacity: 0.5;
background-color: #808080;
}
.vs-dark .monaco-workbench .panel.integrated-terminal .xterm .xterm-selection div {
background-color: #808080;
}
.hc-black .monaco-workbench .panel.integrated-terminal .xterm .xterm-selection div {
background-color: #FFF;
}

.monaco-workbench .panel.integrated-terminal .xterm .xterm-bold {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,13 @@ export const TERMINAL_BACKGROUND_COLOR = registerColor('terminal.background', nu
export const TERMINAL_FOREGROUND_COLOR = registerColor('terminal.foreground', {
light: '#333333',
dark: '#CCCCCC',
hc: 'FFFFFF'
hc: '#FFFFFF'
}, nls.localize('terminal.foreground', 'The foreground color of the terminal.'));
export const TERMINAL_SELECTION_BACKGROUND_COLOR = registerColor('terminal.selectionBackground', {
light: '#B0B0B0',
dark: '#404040',
hc: '#808080'
}, nls.localize('terminal.selectionBackground', 'The selection background color of the terminal.'));

const ansiColorMap = {
'terminal.ansiBlack': {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { ITerminalService, ITerminalFont, TERMINAL_PANEL_ID } from 'vs/workbench/parts/terminal/common/terminal';
import { IThemeService, ITheme } from 'vs/platform/theme/common/themeService';
import { TerminalFindWidget } from './terminalFindWidget';
import { ansiColorIdentifiers, TERMINAL_BACKGROUND_COLOR, TERMINAL_FOREGROUND_COLOR } from './terminalColorRegistry';
import { ColorIdentifier, selectionBackground } from 'vs/platform/theme/common/colorRegistry';
import { ansiColorIdentifiers, TERMINAL_BACKGROUND_COLOR, TERMINAL_FOREGROUND_COLOR, TERMINAL_SELECTION_BACKGROUND_COLOR } from './terminalColorRegistry';
import { ColorIdentifier } from 'vs/platform/theme/common/colorRegistry';
import { KillTerminalAction, CreateNewTerminalAction, SwitchTerminalInstanceAction, SwitchTerminalInstanceActionItem, CopyTerminalSelectionAction, TerminalPasteAction, ClearTerminalAction } from 'vs/workbench/parts/terminal/electron-browser/terminalActions';
import { Panel } from 'vs/workbench/browser/panel';
import { StandardMouseEvent } from 'vs/base/browser/mouseEvent';
Expand Down Expand Up @@ -277,13 +277,9 @@ export class TerminalPanel extends Panel {
`.monaco-workbench .panel.integrated-terminal .xterm.xterm-cursor-style-bar.focus.xterm-cursor-blink .terminal-cursor::before,` +
`.monaco-workbench .panel.integrated-terminal .xterm.xterm-cursor-style-underline.focus.xterm-cursor-blink .terminal-cursor::before { background-color: ${fgColor}; }`;
}
// Use selection.background as the terminal selection, this is temporary
// until proper color inverting is implemented to ensure contrast.
const selectionColor = theme.getColor(selectionBackground);
const selectionColor = theme.getColor(TERMINAL_SELECTION_BACKGROUND_COLOR);
if (selectionColor) {
// selection.background is set to null when not defined by the
// theme, as such it's default values are defined in CSS.
css += `.monaco-workbench .panel.integrated-terminal .xterm .xterm-selection div { background-color: ${selectionColor} !important; }`;
css += `.monaco-workbench .panel.integrated-terminal .xterm .xterm-selection div { background-color: ${selectionColor}; }`;
}

this._themeStyleElement.innerHTML = css;
Expand Down

0 comments on commit 435f1ef

Please sign in to comment.