diff --git a/build/lib/stylelint/vscode-known-variables.json b/build/lib/stylelint/vscode-known-variables.json index 8f6ce9b030d..dea532739cb 100644 --- a/build/lib/stylelint/vscode-known-variables.json +++ b/build/lib/stylelint/vscode-known-variables.json @@ -203,6 +203,7 @@ "--vscode-editorBracketHighlight-unexpectedBracket-foreground", "--vscode-editorBracketMatch-background", "--vscode-editorBracketMatch-border", + "--vscode-editorBracketMatch-foreground", "--vscode-editorBracketPairGuide-activeBackground1", "--vscode-editorBracketPairGuide-activeBackground2", "--vscode-editorBracketPairGuide-activeBackground3", diff --git a/src/vs/editor/common/core/editorColorRegistry.ts b/src/vs/editor/common/core/editorColorRegistry.ts index dc5e5e7f7c8..e71205d88c2 100644 --- a/src/vs/editor/common/core/editorColorRegistry.ts +++ b/src/vs/editor/common/core/editorColorRegistry.ts @@ -55,6 +55,7 @@ export const editorCodeLensForeground = registerColor('editorCodeLens.foreground export const editorBracketMatchBackground = registerColor('editorBracketMatch.background', { dark: '#0064001a', light: '#0064001a', hcDark: '#0064001a', hcLight: '#0000' }, nls.localize('editorBracketMatchBackground', 'Background color behind matching brackets')); export const editorBracketMatchBorder = registerColor('editorBracketMatch.border', { dark: '#888', light: '#B9B9B9', hcDark: contrastBorder, hcLight: contrastBorder }, nls.localize('editorBracketMatchBorder', 'Color for matching brackets boxes')); +export const editorBracketMatchForeground = registerColor('editorBracketMatch.foreground', null, nls.localize('editorBracketMatchForeground', 'Foreground color for matching brackets')); export const editorOverviewRulerBorder = registerColor('editorOverviewRuler.border', { dark: '#7f7f7f4d', light: '#7f7f7f4d', hcDark: '#7f7f7f4d', hcLight: '#666666' }, nls.localize('editorOverviewRulerBorder', 'Color of the overview ruler border.')); export const editorOverviewRulerBackground = registerColor('editorOverviewRuler.background', null, nls.localize('editorOverviewRulerBackground', 'Background color of the editor overview ruler.')); diff --git a/src/vs/editor/contrib/bracketMatching/browser/bracketMatching.ts b/src/vs/editor/contrib/bracketMatching/browser/bracketMatching.ts index 7e64b4e28c8..0b362ca15ad 100644 --- a/src/vs/editor/contrib/bracketMatching/browser/bracketMatching.ts +++ b/src/vs/editor/contrib/bracketMatching/browser/bracketMatching.ts @@ -21,7 +21,8 @@ import * as nls from '../../../../nls.js'; import { MenuId, MenuRegistry } from '../../../../platform/actions/common/actions.js'; import { KeybindingWeight } from '../../../../platform/keybinding/common/keybindingsRegistry.js'; import { registerColor } from '../../../../platform/theme/common/colorRegistry.js'; -import { themeColorFromId } from '../../../../platform/theme/common/themeService.js'; +import { registerThemingParticipant, themeColorFromId } from '../../../../platform/theme/common/themeService.js'; +import { editorBracketMatchForeground } from '../../../common/core/editorColorRegistry.js'; const overviewRulerBracketMatchForeground = registerColor('editorOverviewRuler.bracketMatchForeground', '#A0A0A0', nls.localize('overviewRulerBracketMatchForeground', 'Overview ruler marker color for matching brackets.')); @@ -299,7 +300,7 @@ export class BracketMatchingController extends Disposable implements IEditorCont private static readonly _DECORATION_OPTIONS_WITH_OVERVIEW_RULER = ModelDecorationOptions.register({ description: 'bracket-match-overview', stickiness: TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges, - className: 'bracket-match', + inlineClassName: 'bracket-match', overviewRuler: { color: themeColorFromId(overviewRulerBracketMatchForeground), position: OverviewRulerLane.Center @@ -309,7 +310,7 @@ export class BracketMatchingController extends Disposable implements IEditorCont private static readonly _DECORATION_OPTIONS_WITHOUT_OVERVIEW_RULER = ModelDecorationOptions.register({ description: 'bracket-match-no-overview', stickiness: TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges, - className: 'bracket-match' + inlineClassName: 'bracket-match' }); private _updateBrackets(): void { @@ -414,3 +415,12 @@ MenuRegistry.appendMenuItem(MenuId.MenubarGoMenu, { }, order: 2 }); + +// Theming participant to ensure bracket-match color overrides bracket pair colorization +registerThemingParticipant((theme, collector) => { + const bracketMatchForeground = theme.getColor(editorBracketMatchForeground); + if (bracketMatchForeground) { + // Use higher specificity to override bracket pair colorization + collector.addRule(`.monaco-editor .bracket-match { color: ${bracketMatchForeground} !important; }`); + } +});