From 54ee1655f69764e072781c9882ab993d1f7c6c44 Mon Sep 17 00:00:00 2001 From: Martin Aeschlimann Date: Sun, 5 Jan 2020 20:02:35 +0100 Subject: [PATCH] folded background uses transparent selection color. Fixes #88070, fixes #87891 --- src/vs/editor/contrib/folding/folding.ts | 11 +++++++++++ src/vs/editor/contrib/folding/foldingModel.ts | 12 ------------ 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/vs/editor/contrib/folding/folding.ts b/src/vs/editor/contrib/folding/folding.ts index e1bbbf1b520..3e18219d6b8 100644 --- a/src/vs/editor/contrib/folding/folding.ts +++ b/src/vs/editor/contrib/folding/folding.ts @@ -32,6 +32,8 @@ import { InitializingRangeProvider, ID_INIT_PROVIDER } from 'vs/editor/contrib/f import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; import { onUnexpectedError } from 'vs/base/common/errors'; import { RawContextKey, IContextKey, IContextKeyService } from 'vs/platform/contextkey/common/contextkey'; +import { registerThemingParticipant } from 'vs/platform/theme/common/themeService'; +import { registerColor, editorSelectionBackground, transparent } from 'vs/platform/theme/common/colorRegistry'; const CONTEXT_FOLDING_ENABLED = new RawContextKey('foldingEnabled', false); @@ -884,3 +886,12 @@ for (let i = 1; i <= 7; i++) { }) ); } + +export const foldBackgroundBackground = registerColor('editor.foldBackground', { light: transparent(editorSelectionBackground, 0.3), dark: transparent(editorSelectionBackground, 0.3), hc: null }, nls.localize('editorSelectionBackground', "Color of the editor selection.")); + +registerThemingParticipant((theme, collector) => { + const foldBackground = theme.getColor(foldBackgroundBackground); + if (foldBackground) { + collector.addRule(`.monaco-editor .folded-background { background-color: ${foldBackground}; }`); + } +}); diff --git a/src/vs/editor/contrib/folding/foldingModel.ts b/src/vs/editor/contrib/folding/foldingModel.ts index 386c923f834..9a91caa0235 100644 --- a/src/vs/editor/contrib/folding/foldingModel.ts +++ b/src/vs/editor/contrib/folding/foldingModel.ts @@ -6,9 +6,6 @@ import { ITextModel, IModelDecorationOptions, IModelDeltaDecoration, IModelDecorationsChangeAccessor } from 'vs/editor/common/model'; import { Event, Emitter } from 'vs/base/common/event'; import { FoldingRegions, ILineRange, FoldingRegion } from './foldingRanges'; -import { registerThemingParticipant } from 'vs/platform/theme/common/themeService'; -import { registerColor, editorSelectionBackground, darken, lighten } from 'vs/platform/theme/common/colorRegistry'; -import * as nls from 'vs/nls'; export interface IDecorationProvider { getDecorationOption(isCollapsed: boolean): IModelDecorationOptions; @@ -357,12 +354,3 @@ export function setCollapseStateForType(foldingModel: FoldingModel, type: string } foldingModel.toggleCollapseState(toToggle); } - -export const foldBackgroundBackground = registerColor('editor.foldBackground', { light: lighten(editorSelectionBackground, 0.5), dark: darken(editorSelectionBackground, 0.5), hc: null }, nls.localize('editorSelectionBackground', "Color of the editor selection.")); - -registerThemingParticipant((theme, collector) => { - const foldBackground = theme.getColor(foldBackgroundBackground); - if (foldBackground) { - collector.addRule(`.monaco-editor .folded-background { background-color: ${foldBackground}; }`); - } -}); -- GitLab