From ab5846a2ab4a25df02997de7e894582521d5a532 Mon Sep 17 00:00:00 2001 From: Alex Dima Date: Fri, 23 Jun 2017 10:29:11 +0200 Subject: [PATCH] Do not use `mix-blend-mode: difference` for `hc-black` --- src/vs/editor/browser/viewParts/lines/viewLine.ts | 2 +- .../browser/viewParts/selections/selections.ts | 14 ++++++-------- src/vs/editor/browser/widget/media/tokens.css | 4 +--- src/vs/platform/theme/common/colorRegistry.ts | 7 ++++--- .../themes/electron-browser/themeCompatibility.ts | 2 +- 5 files changed, 13 insertions(+), 16 deletions(-) diff --git a/src/vs/editor/browser/viewParts/lines/viewLine.ts b/src/vs/editor/browser/viewParts/lines/viewLine.ts index e5aa5b80bc8..6d1c5d8be56 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 9d8e0168f25..25354eff6c3 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 5050a535870..3b0784d077a 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 8b185bb2661..7efeec4794e 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 cd591bccb20..eece1c5c808 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); -- GitLab