Skip to content

Commit 634068a

Browse files
authored
Merge pull request microsoft#90631 from baileyherbert/minimap-slider
Add minimap slider color options
2 parents bb04e41 + e14b2ab commit 634068a

2 files changed

Lines changed: 11 additions & 10 deletions

File tree

src/vs/editor/browser/viewParts/minimap/minimap.ts

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import { RenderingContext, RestrictedRenderingContext } from 'vs/editor/common/v
2525
import { ViewContext, EditorTheme } from 'vs/editor/common/view/viewContext';
2626
import * as viewEvents from 'vs/editor/common/view/viewEvents';
2727
import { ViewLineData, ViewModelDecoration } from 'vs/editor/common/viewModel/viewModel';
28-
import { minimapSelection, scrollbarShadow, scrollbarSliderActiveBackground, scrollbarSliderBackground, scrollbarSliderHoverBackground, minimapBackground } from 'vs/platform/theme/common/colorRegistry';
28+
import { minimapSelection, scrollbarShadow, minimapBackground, minimapSliderBackground, minimapSliderHoverBackground, minimapSliderActiveBackground} from 'vs/platform/theme/common/colorRegistry';
2929
import { registerThemingParticipant } from 'vs/platform/theme/common/themeService';
3030
import { ModelDecorationMinimapOptions } from 'vs/editor/common/model/textModel';
3131
import { Selection } from 'vs/editor/common/core/selection';
@@ -1724,20 +1724,17 @@ registerThemingParticipant((theme, collector) => {
17241724
if (minimapBackgroundValue) {
17251725
collector.addRule(`.monaco-editor .minimap > canvas { opacity: ${minimapBackgroundValue.rgba.a}; will-change: opacity; }`);
17261726
}
1727-
const sliderBackground = theme.getColor(scrollbarSliderBackground);
1727+
const sliderBackground = theme.getColor(minimapSliderBackground);
17281728
if (sliderBackground) {
1729-
const halfSliderBackground = sliderBackground.transparent(0.5);
1730-
collector.addRule(`.monaco-editor .minimap-slider, .monaco-editor .minimap-slider .minimap-slider-horizontal { background: ${halfSliderBackground}; }`);
1729+
collector.addRule(`.monaco-editor .minimap-slider .minimap-slider-horizontal { background: ${sliderBackground}; }`);
17311730
}
1732-
const sliderHoverBackground = theme.getColor(scrollbarSliderHoverBackground);
1731+
const sliderHoverBackground = theme.getColor(minimapSliderHoverBackground);
17331732
if (sliderHoverBackground) {
1734-
const halfSliderHoverBackground = sliderHoverBackground.transparent(0.5);
1735-
collector.addRule(`.monaco-editor .minimap-slider:hover, .monaco-editor .minimap-slider:hover .minimap-slider-horizontal { background: ${halfSliderHoverBackground}; }`);
1733+
collector.addRule(`.monaco-editor .minimap-slider:hover .minimap-slider-horizontal { background: ${sliderHoverBackground}; }`);
17361734
}
1737-
const sliderActiveBackground = theme.getColor(scrollbarSliderActiveBackground);
1735+
const sliderActiveBackground = theme.getColor(minimapSliderActiveBackground);
17381736
if (sliderActiveBackground) {
1739-
const halfSliderActiveBackground = sliderActiveBackground.transparent(0.5);
1740-
collector.addRule(`.monaco-editor .minimap-slider.active, .monaco-editor .minimap-slider.active .minimap-slider-horizontal { background: ${halfSliderActiveBackground}; }`);
1737+
collector.addRule(`.monaco-editor .minimap-slider.active .minimap-slider-horizontal { background: ${sliderActiveBackground}; }`);
17411738
}
17421739
const shadow = theme.getColor(scrollbarShadow);
17431740
if (shadow) {

src/vs/platform/theme/common/colorRegistry.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,10 @@ export const minimapError = registerColor('minimap.errorHighlight', { dark: new
426426
export const minimapWarning = registerColor('minimap.warningHighlight', { dark: editorWarningForeground, light: editorWarningForeground, hc: editorWarningBorder }, nls.localize('overviewRuleWarning', 'Minimap marker color for warnings.'));
427427
export const minimapBackground = registerColor('minimap.background', { dark: null, light: null, hc: null }, nls.localize('minimapBackground', "Minimap background color."));
428428

429+
export const minimapSliderBackground = registerColor('minimapSlider.background', { light: transparent(scrollbarSliderBackground, 0.5), dark: transparent(scrollbarSliderBackground, 0.5), hc: transparent(scrollbarSliderBackground, 0.5) }, nls.localize('minimapSliderBackground', "Minimap slider background color."));
430+
export const minimapSliderHoverBackground = registerColor('minimapSlider.hoverBackground', { light: transparent(scrollbarSliderHoverBackground, 0.5), dark: transparent(scrollbarSliderHoverBackground, 0.5), hc: transparent(scrollbarSliderHoverBackground, 0.5) }, nls.localize('minimapSliderHoverBackground', "Minimap slider background color when hovering."));
431+
export const minimapSliderActiveBackground = registerColor('minimapSlider.activeBackground', { light: transparent(scrollbarSliderActiveBackground, 0.5), dark: transparent(scrollbarSliderActiveBackground, 0.5), hc: transparent(scrollbarSliderActiveBackground, 0.5) }, nls.localize('minimapSliderActiveBackground', "Minimap slider background color when clicked on."));
432+
429433
export const problemsErrorIconForeground = registerColor('problemsErrorIcon.foreground', { dark: editorErrorForeground, light: editorErrorForeground, hc: editorErrorForeground }, nls.localize('problemsErrorIconForeground', "The color used for the problems error icon."));
430434
export const problemsWarningIconForeground = registerColor('problemsWarningIcon.foreground', { dark: editorWarningForeground, light: editorWarningForeground, hc: editorWarningForeground }, nls.localize('problemsWarningIconForeground', "The color used for the problems warning icon."));
431435
export const problemsInfoIconForeground = registerColor('problemsInfoIcon.foreground', { dark: editorInfoForeground, light: editorInfoForeground, hc: editorInfoForeground }, nls.localize('problemsInfoIconForeground', "The color used for the problems info icon."));

0 commit comments

Comments
 (0)