diff --git a/src/vs/editor/browser/viewParts/lines/viewLine.ts b/src/vs/editor/browser/viewParts/lines/viewLine.ts index e5aa5b80bc805456e1de6e6f4f5c0a3c5e161726..6d1c5d8be5676397d89781790d088fb5f7fc631c 100644 --- a/src/vs/editor/browser/viewParts/lines/viewLine.ts +++ b/src/vs/editor/browser/viewParts/lines/viewLine.ts @@ -149,7 +149,7 @@ export class ViewLine implements IVisibleLine { this._options = newOptions; } public onSelectionChanged(): boolean { - if (alwaysRenderInlineSelection) { + if (alwaysRenderInlineSelection || this._options.themeType === HIGH_CONTRAST) { this._isMaybeInvalid = true; return true; } diff --git a/src/vs/editor/browser/viewParts/selections/selections.ts b/src/vs/editor/browser/viewParts/selections/selections.ts index 9d8e0168f256b9ebc5aaa6be03d63e3a676f5542..25354eff6c3b0ee504515396c2955c35e7f842ec 100644 --- a/src/vs/editor/browser/viewParts/selections/selections.ts +++ b/src/vs/editor/browser/viewParts/selections/selections.ts @@ -7,7 +7,7 @@ import 'vs/css!./selections'; import { registerThemingParticipant } from 'vs/platform/theme/common/themeService'; -import { editorSelection, editorInactiveSelection, activeContrastBorder } from 'vs/platform/theme/common/colorRegistry'; +import { editorSelectionBackground, editorInactiveSelection, editorSelectionForeground } from 'vs/platform/theme/common/colorRegistry'; import { DynamicViewOverlay } from 'vs/editor/browser/view/dynamicViewOverlay'; import { ViewContext } from 'vs/editor/common/view/viewContext'; import { HorizontalRange, LineVisibleRanges, RenderingContext } from 'vs/editor/common/view/renderingContext'; @@ -394,7 +394,7 @@ export class SelectionsOverlay extends DynamicViewOverlay { } registerThemingParticipant((theme, collector) => { - let editorSelectionColor = theme.getColor(editorSelection); + let editorSelectionColor = theme.getColor(editorSelectionBackground); if (editorSelectionColor) { collector.addRule(`.monaco-editor .focused .selected-text { background-color: ${editorSelectionColor}; }`); } @@ -402,10 +402,8 @@ registerThemingParticipant((theme, collector) => { if (editorInactiveSelectionColor) { collector.addRule(`.monaco-editor .selected-text { background-color: ${editorInactiveSelectionColor}; }`); } - // IE/Edge specific rules - let outline = theme.getColor(activeContrastBorder); - if (outline) { - collector.addRule(`.monaco-editor.ie.hc-black .view-overlays.focused .selected-text { background: none; border: 2px solid ${outline}; }`); - collector.addRule(`.monaco-editor.edge.hc-black .view-overlays.focused .selected-text { background: none; border: 2px solid ${outline}; }`); + let editorSelectionForegroundColor = theme.getColor(editorSelectionForeground); + if (editorSelectionForegroundColor) { + collector.addRule(`.monaco-editor .view-line span.inline-selected-text { color: ${editorSelectionForegroundColor}; }`); } -}); \ No newline at end of file +}); diff --git a/src/vs/editor/browser/widget/media/tokens.css b/src/vs/editor/browser/widget/media/tokens.css index 5050a5358709ec9aa8280dc38f9145139669d97d..3b0784d077acf6755c433b459147d2e0abec1426 100644 --- a/src/vs/editor/browser/widget/media/tokens.css +++ b/src/vs/editor/browser/widget/media/tokens.css @@ -6,6 +6,4 @@ .monaco-editor .vs-whitespace { display:inline-block; } -.monaco-editor.hc-black .view-line { - mix-blend-mode: difference; -} + diff --git a/src/vs/platform/theme/common/colorRegistry.ts b/src/vs/platform/theme/common/colorRegistry.ts index 8b185bb26618b2a1430e3c16c744fc3a3963c234..7efeec4794ea6ef48222eccdccd84c98cab2ae3f 100644 --- a/src/vs/platform/theme/common/colorRegistry.ts +++ b/src/vs/platform/theme/common/colorRegistry.ts @@ -219,9 +219,10 @@ export const editorWidgetBorder = registerColor('editorWidget.border', { dark: ' /** * Editor selection colors. */ -export const editorSelection = registerColor('editor.selectionBackground', { light: '#ADD6FF', dark: '#264F78', hc: '#f3f518' }, nls.localize('editorSelection', "Color of the editor selection.")); -export const editorInactiveSelection = registerColor('editor.inactiveSelectionBackground', { light: transparent(editorSelection, 0.5), dark: transparent(editorSelection, 0.5), hc: null }, nls.localize('editorInactiveSelection', "Color of the selection in an inactive editor.")); -export const editorSelectionHighlight = registerColor('editor.selectionHighlightBackground', { light: lessProminent(editorSelection, editorBackground, 0.3, 0.6), dark: lessProminent(editorSelection, editorBackground, 0.3, 0.6), hc: null }, nls.localize('editorSelectionHighlight', 'Color for regions with the same content as the selection.')); +export const editorSelectionBackground = registerColor('editor.selectionBackground', { light: '#ADD6FF', dark: '#264F78', hc: '#f3f518' }, nls.localize('editorSelectionBackground', "Color of the editor selection.")); +export const editorSelectionForeground = registerColor('editor.selectionForeground', { light: null, dark: null, hc: '#000000' }, nls.localize('editorSelectionForeground', "Color of the selected text for high contrast.")); +export const editorInactiveSelection = registerColor('editor.inactiveSelectionBackground', { light: transparent(editorSelectionBackground, 0.5), dark: transparent(editorSelectionBackground, 0.5), hc: transparent(editorSelectionBackground, 0.5) }, nls.localize('editorInactiveSelection', "Color of the selection in an inactive editor.")); +export const editorSelectionHighlight = registerColor('editor.selectionHighlightBackground', { light: lessProminent(editorSelectionBackground, editorBackground, 0.3, 0.6), dark: lessProminent(editorSelectionBackground, editorBackground, 0.3, 0.6), hc: null }, nls.localize('editorSelectionHighlight', 'Color for regions with the same content as the selection.')); /** * Editor find match colors. diff --git a/src/vs/workbench/services/themes/electron-browser/themeCompatibility.ts b/src/vs/workbench/services/themes/electron-browser/themeCompatibility.ts index cd591bccb200fed097398bf91839148b23384122..eece1c5c8081a0d98f92cffc00e4f42569942904 100644 --- a/src/vs/workbench/services/themes/electron-browser/themeCompatibility.ts +++ b/src/vs/workbench/services/themes/electron-browser/themeCompatibility.ts @@ -53,7 +53,7 @@ export function convertSettings(oldSettings: ITokenColorizationRule[], resultRul addSettingMapping('background', colorRegistry.editorBackground); addSettingMapping('foreground', colorRegistry.editorForeground); -addSettingMapping('selection', colorRegistry.editorSelection); +addSettingMapping('selection', colorRegistry.editorSelectionBackground); addSettingMapping('inactiveSelection', colorRegistry.editorInactiveSelection); addSettingMapping('selectionHighlightColor', colorRegistry.editorSelectionHighlight); addSettingMapping('findMatchHighlight', colorRegistry.editorFindMatchHighlight);