Skip to content

Commit 9712603

Browse files
Allow theming the diff view's diagonal fill with diffEditor.diagonalFill
1 parent 711dac0 commit 9712603

4 files changed

Lines changed: 15 additions & 11 deletions

File tree

src/vs/editor/browser/widget/diffEditorWidget.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
3838
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
3939
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection';
4040
import { INotificationService } from 'vs/platform/notification/common/notification';
41-
import { defaultInsertColor, defaultRemoveColor, diffBorder, diffInserted, diffInsertedOutline, diffRemoved, diffRemovedOutline, scrollbarShadow, scrollbarSliderBackground, scrollbarSliderHoverBackground, scrollbarSliderActiveBackground } from 'vs/platform/theme/common/colorRegistry';
41+
import { defaultInsertColor, defaultRemoveColor, diffBorder, diffInserted, diffInsertedOutline, diffRemoved, diffRemovedOutline, scrollbarShadow, scrollbarSliderBackground, scrollbarSliderHoverBackground, scrollbarSliderActiveBackground, diffDiagonalFill } from 'vs/platform/theme/common/colorRegistry';
4242
import { IColorTheme, IThemeService, getThemeTypeSelector, registerThemingParticipant } from 'vs/platform/theme/common/themeService';
4343
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
4444
import { IDiffLinesChange, InlineDiffMargin } from 'vs/editor/browser/widget/inlineDiffMargin';
@@ -2244,4 +2244,17 @@ registerThemingParticipant((theme, collector) => {
22442244
`);
22452245
}
22462246

2247+
const diffDiagonalFillColor = theme.getColor(diffDiagonalFill);
2248+
collector.addRule(`
2249+
.monaco-editor .diagonal-fill {
2250+
background-image: linear-gradient(
2251+
-45deg,
2252+
${diffDiagonalFillColor} 12.5%,
2253+
#0000 12.5%, #0000 50%,
2254+
${diffDiagonalFillColor} 50%, ${diffDiagonalFillColor} 62.5%,
2255+
#0000 62.5%, #0000 100%
2256+
);
2257+
background-size: 8px 8px;
2258+
}
2259+
`);
22472260
});
-185 Bytes
Binary file not shown.

src/vs/editor/browser/widget/media/diffEditor.css

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -51,16 +51,6 @@
5151
text-align: right;
5252
}
5353

54-
.monaco-editor .diagonal-fill {
55-
background: url('diagonal-fill.png');
56-
}
57-
.monaco-editor.vs-dark .diagonal-fill {
58-
opacity: 0.2;
59-
}
60-
.monaco-editor.hc-black .diagonal-fill {
61-
background: none;
62-
}
63-
6454
/* ---------- Inline Diff ---------- */
6555

6656
.monaco-editor .view-zones .view-lines .view-line span {

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,7 @@ export const diffInsertedOutline = registerColor('diffEditor.insertedTextBorder'
341341
export const diffRemovedOutline = registerColor('diffEditor.removedTextBorder', { dark: null, light: null, hc: '#FF008F' }, nls.localize('diffEditorRemovedOutline', 'Outline color for text that got removed.'));
342342

343343
export const diffBorder = registerColor('diffEditor.border', { dark: null, light: null, hc: contrastBorder }, nls.localize('diffEditorBorder', 'Border color between the two text editors.'));
344+
export const diffDiagonalFill = registerColor('diffEditor.diagonalFill', { dark: '#cccccc33', light: '#22222233', hc: null }, nls.localize('diffDiagonalFill', "Color of the diff editor's diagonal fill. The diagonal fill is used in side-by-side diff views."));
344345

345346
/**
346347
* List and tree colors

0 commit comments

Comments
 (0)