Skip to content

Commit 17b94cf

Browse files
authored
Add notebook.editorBackground color customization (microsoft#153255)
Fixes microsoft#147693
1 parent 3b3469d commit 17b94cf

File tree

1 file changed

+22
-9
lines changed

1 file changed

+22
-9
lines changed

src/vs/workbench/contrib/notebook/browser/notebookEditorWidget.ts

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ import { IEditorProgressService, IProgressRunner } from 'vs/platform/progress/co
4747
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
4848
import { contrastBorder, diffInserted, diffRemoved, editorBackground, errorForeground, focusBorder, foreground, iconForeground, listInactiveSelectionBackground, registerColor, scrollbarSliderActiveBackground, scrollbarSliderBackground, scrollbarSliderHoverBackground, textBlockQuoteBackground, textBlockQuoteBorder, textLinkActiveForeground, textLinkForeground, textPreformatForeground, toolbarHoverBackground, transparent } from 'vs/platform/theme/common/colorRegistry';
4949
import { registerThemingParticipant } from 'vs/platform/theme/common/themeService';
50-
import { PANEL_BORDER, SIDE_BAR_BACKGROUND } from 'vs/workbench/common/theme';
50+
import { EDITOR_PANE_BACKGROUND, PANEL_BORDER, SIDE_BAR_BACKGROUND } from 'vs/workbench/common/theme';
5151
import { debugIconStartForeground } from 'vs/workbench/contrib/debug/browser/debugColors';
5252
import { CellEditState, CellFindMatchWithIndex, CellFocusMode, CellLayoutContext, CellRevealType, IActiveNotebookEditorDelegate, IBaseCellEditorOptions, ICellOutputViewModel, ICellViewModel, ICommonCellInfo, IDisplayOutputLayoutUpdateRequest, IFocusNotebookCellOptions, IInsetRenderOutput, IModelDecorationsChangeAccessor, INotebookDeltaDecoration, INotebookEditor, INotebookEditorContribution, INotebookEditorContributionDescription, INotebookEditorCreationOptions, INotebookEditorDelegate, INotebookEditorMouseEvent, INotebookEditorOptions, INotebookEditorViewState, INotebookViewCellsUpdateEvent, INotebookWebviewMessage, RenderOutputType } from 'vs/workbench/contrib/notebook/browser/notebookBrowser';
5353
import { NotebookEditorExtensionsRegistry } from 'vs/workbench/contrib/notebook/browser/notebookEditorExtensions';
@@ -919,21 +919,21 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditorD
919919
transformOptimization: false, //(isMacintosh && isNative) || getTitleBarStyle(this.configurationService, this.environmentService) === 'native',
920920
styleController: (_suffix: string) => { return this._list; },
921921
overrideStyles: {
922-
listBackground: editorBackground,
923-
listActiveSelectionBackground: editorBackground,
922+
listBackground: notebookEditorBackground,
923+
listActiveSelectionBackground: notebookEditorBackground,
924924
listActiveSelectionForeground: foreground,
925-
listFocusAndSelectionBackground: editorBackground,
925+
listFocusAndSelectionBackground: notebookEditorBackground,
926926
listFocusAndSelectionForeground: foreground,
927-
listFocusBackground: editorBackground,
927+
listFocusBackground: notebookEditorBackground,
928928
listFocusForeground: foreground,
929929
listHoverForeground: foreground,
930-
listHoverBackground: editorBackground,
930+
listHoverBackground: notebookEditorBackground,
931931
listHoverOutline: focusBorder,
932932
listFocusOutline: focusBorder,
933-
listInactiveSelectionBackground: editorBackground,
933+
listInactiveSelectionBackground: notebookEditorBackground,
934934
listInactiveSelectionForeground: foreground,
935-
listInactiveFocusBackground: editorBackground,
936-
listInactiveFocusOutline: editorBackground,
935+
listInactiveFocusBackground: notebookEditorBackground,
936+
listInactiveFocusOutline: notebookEditorBackground,
937937
},
938938
accessibilityProvider: {
939939
getAriaLabel: (element) => {
@@ -3157,6 +3157,13 @@ export const cellEditorBackground = registerColor('notebook.cellEditorBackground
31573157
hcLight: null
31583158
}, nls.localize('notebook.cellEditorBackground', "Cell editor background color."));
31593159

3160+
export const notebookEditorBackground = registerColor('notebook.editorBackground', {
3161+
light: EDITOR_PANE_BACKGROUND,
3162+
dark: EDITOR_PANE_BACKGROUND,
3163+
hcDark: null,
3164+
hcLight: null
3165+
}, nls.localize('notebook.editorBackground', "Notebook background color."));
3166+
31603167
registerThemingParticipant((theme, collector) => {
31613168
// add css variable rules
31623169

@@ -3234,6 +3241,12 @@ registerThemingParticipant((theme, collector) => {
32343241
collector.addRule(`.notebookOverlay .cell-list-top-cell-toolbar-container .action-item { background-color: ${notebookBackground} }`);
32353242
}
32363243

3244+
const notebookBackgroundColor = theme.getColor(notebookEditorBackground);
3245+
3246+
if (notebookBackgroundColor) {
3247+
collector.addRule(`.monaco-workbench .notebookOverlay.notebook-editor { background-color: ${notebookBackgroundColor}; }`);
3248+
}
3249+
32373250
const editorBackgroundColor = theme.getColor(cellEditorBackground) ?? theme.getColor(editorBackground);
32383251
if (editorBackgroundColor) {
32393252
collector.addRule(`.notebookOverlay .cell .monaco-editor-background,

0 commit comments

Comments
 (0)