From 5a0d53823bf643399df80e20132f53c929d63aa5 Mon Sep 17 00:00:00 2001 From: Alex Dima Date: Thu, 4 Nov 2021 22:59:49 +0100 Subject: [PATCH] Fixes microsoft/monaco-editor#2660: If available, create a rule for default tokens using the `editor.foreground` and `editor.background` colors --- .../browser/standaloneThemeServiceImpl.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/vs/editor/standalone/browser/standaloneThemeServiceImpl.ts b/src/vs/editor/standalone/browser/standaloneThemeServiceImpl.ts index 779f91ebf31..9feb2e1bcb3 100644 --- a/src/vs/editor/standalone/browser/standaloneThemeServiceImpl.ts +++ b/src/vs/editor/standalone/browser/standaloneThemeServiceImpl.ts @@ -132,6 +132,19 @@ class StandaloneTheme implements IStandaloneTheme { encodedTokensColors = baseData.encodedTokensColors; } } + // Pick up default colors from `editor.foreground` and `editor.background` if available + const editorForeground = this.themeData.colors['editor.foreground']; + const editorBackground = this.themeData.colors['editor.background']; + if (editorForeground || editorBackground) { + const rule: ITokenThemeRule = { token: '' }; + if (editorForeground) { + rule.foreground = editorForeground; + } + if (editorBackground) { + rule.background = editorBackground; + } + rules.push(rule); + } rules = rules.concat(this.themeData.rules); if (this.themeData.encodedTokensColors) { encodedTokensColors = this.themeData.encodedTokensColors;