Or Gal
Or Gal

Reputation: 1366

How to set matching bracket color in vscode?

I would like matching brackets in vscode to be colored instead of given a border/background. What is the correct property for it in setting? Currently I have this:

    {
        "workbench.colorCustomizations": {

            "editorBracketMatch.border": "#000",
            "editorBracketMatch.background": "#000"
        }
    }

How should I modify this to get the desired result?

Upvotes: 5

Views: 1882

Answers (1)

VonC
VonC

Reputation: 1323223

VSCode 1.60, Aug. 2021 will support that directly:

High performance bracket pair colorization

The editor now supports native bracket pair colorization:

Side by side comparison with bracket pair colorization on and off

Bracket pair colorization can be enabled by setting "editor.bracketPairColorization.enabled": true.
All colors are themeable and up to six colors can be configured.

We implemented this feature to address performance issues of the famous Bracket Pair Colorizer extension by CoenraadS.

In the settings, you can set colors from foreground1 to foreground6:

 colorCustomizations:

{
  "workbench.colorCustomizations": {

    "editorBracketHighlight.foreground1": "#3700ff",
    "editorBracketHighlight.foreground2": "#66ff00",
    "editorBracketHighlight.unexpectedBracket.foreground": "#ff0000",
  }
}

VSCode 1.66 (Feb. 2022) will port over a feature from Bracket Pair Colorizer 2:

"bracket-pair-colorizer-2.colorMode"

  • Consecutive brackets share a color pool for all bracket types
    https://user-images.githubusercontent.com/75278/129780518-3bef1d29-8b79-4ec5-8f24-5d9321617acc.png
  • Independent brackets allow each bracket type to use its own color pool https://user-images.githubusercontent.com/75278/129780532-0d8d457c-1c33-4c1e-8ed5-e82086c47d3c.png

See commit d54c705 and setting editor.bracketPairColorization.useIndependentColorPoolPerBracketType.


See also "Custom brace highlighting in Visual Studio Code" with VSCode 1.76, Feb. 2023, where you can configure highlights for a subset of brackets.

Upvotes: 6

Related Questions