Skip to content

Commit e3dc04a

Browse files
committed
Add slider color options
1 parent 6a95140 commit e3dc04a

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 } 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';
@@ -1158,20 +1158,17 @@ registerThemingParticipant((theme, collector) => {
11581158
if (minimapBackgroundValue) {
11591159
collector.addRule(`.monaco-editor .minimap > canvas { opacity: ${minimapBackgroundValue.rgba.a}; will-change: opacity; }`);
11601160
}
1161-
const sliderBackground = theme.getColor(scrollbarSliderBackground);
1161+
const sliderBackground = theme.getColor(minimapSliderBackground);
11621162
if (sliderBackground) {
1163-
const halfSliderBackground = sliderBackground.transparent(0.5);
1164-
collector.addRule(`.monaco-editor .minimap-slider, .monaco-editor .minimap-slider .minimap-slider-horizontal { background: ${halfSliderBackground}; }`);
1163+
collector.addRule(`.monaco-editor .minimap-slider .minimap-slider-horizontal { background: ${sliderBackground}; }`);
11651164
}
1166-
const sliderHoverBackground = theme.getColor(scrollbarSliderHoverBackground);
1165+
const sliderHoverBackground = theme.getColor(minimapSliderHoverBackground);
11671166
if (sliderHoverBackground) {
1168-
const halfSliderHoverBackground = sliderHoverBackground.transparent(0.5);
1169-
collector.addRule(`.monaco-editor .minimap-slider:hover, .monaco-editor .minimap-slider:hover .minimap-slider-horizontal { background: ${halfSliderHoverBackground}; }`);
1167+
collector.addRule(`.monaco-editor .minimap-slider:hover .minimap-slider-horizontal { background: ${sliderHoverBackground}; }`);
11701168
}
1171-
const sliderActiveBackground = theme.getColor(scrollbarSliderActiveBackground);
1169+
const sliderActiveBackground = theme.getColor(minimapSliderActiveBackground);
11721170
if (sliderActiveBackground) {
1173-
const halfSliderActiveBackground = sliderActiveBackground.transparent(0.5);
1174-
collector.addRule(`.monaco-editor .minimap-slider.active, .monaco-editor .minimap-slider.active .minimap-slider-horizontal { background: ${halfSliderActiveBackground}; }`);
1171+
collector.addRule(`.monaco-editor .minimap-slider.active .minimap-slider-horizontal { background: ${sliderActiveBackground}; }`);
11751172
}
11761173
const shadow = theme.getColor(scrollbarShadow);
11771174
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)