Joan Venge
Joan Venge

Reputation: 330872

How to change the braces/parenthesis colors in Visual Studio

I am not talking about the highlight colors but the actual colors. I got a color scheme with light background color but the braces/parentheses are barely visible. Anyone knows how to change this?

Btw this is for C# because C++ seems to color braces/parentheses using operator color.

Upvotes: 42

Views: 41862

Answers (22)

Lord Darth Vader
Lord Darth Vader

Reputation: 2005

VS 2022

Its now built into VS

Tools > Options > Text Editor > General

Enable Brace pair colorization

Upvotes: 0

Malek Tubaisaht
Malek Tubaisaht

Reputation: 1387

it's a headache bug, happened with me after restarting my PC. the fastest way and the crossroad to fix it is by setting the theme to light them, they back to dark theme it fixed the problem fast.

tool-> options -> General -> light theme -> click ok

then

tool -> options -> General -> Dark theme -> click ok

it fix the color's distrubtions

Upvotes: 2

Legends
Legends

Reputation: 22662

VS 2017 <

The following instruction shows how to change the background color of the matching braces and its rectangles. Click on the picture and take a look at the braces in the source code!

Open Visual Studio --> Tools --> Options

To change the backgroundColor follow the steps in the picture below!

enter image description here

Upvotes: 4

LReeder14
LReeder14

Reputation: 618

In VS2019 - I changed the item below to Lime so that when your mouse is "on" a brace or paren it highlights the one you're on plus the matching brace/paren. The screen shot below shows what I changed and the affect on the braces of my if statement.

Tools > Options > Environment : Fonts and Colors > Display Items : Brace Matching

Note that I clicked on or before the brace and it's lime.

Upvotes: 1

Yan Karlo Teixeira
Yan Karlo Teixeira

Reputation: 1

In VS2019 : Tools > Options > Fonts and Colors > Display Items : VA Brace Matching

Upvotes: 0

dan31
dan31

Reputation: 71

It is "Operator" for C++ (proof below), but "Punctuation" for C#. Change both.

enter image description here

Upvotes: 5

wip
wip

Reputation: 2442

Here are extensions that will colorize paris of matching brackets in the same color:

https://marketplace.visualstudio.com/items?itemName=CoenraadS.bracket-pair-colorizer-2

https://marketplace.visualstudio.com/items?itemName=TomasRestrepo.Viasfora

Upvotes: 3

Robert Green MBA
Robert Green MBA

Reputation: 1866

in VS 2017 it is Tools > Options > Environment > Fonts and Colors > "Display Items" : "Brace Matching"

enter image description here

Upvotes: 1

pandaman1234
pandaman1234

Reputation: 523

For anyone that is here and have the same problem with Visual C++, if you are using visual assist, just know that it overrides the punctuation color scheme mentioned by the others. You have to change the color in the Visual Assist options and set it to another color than black (which is the default color). enter image description here

Upvotes: 3

Stefan Tashev
Stefan Tashev

Reputation: 21

You can change the Punctuation color in VS but it will actually change the color of all elements that fall in the Punctuation category.

If you want a solution which you can fine tune you can use the Semantic Highlighter Extension that we have developed. It can color different parts of code such as braces, brackets, parenthesis, angle brackets and even properties, fields, parameters, namespaces and more.

You can install it as a Visual Studio Extension. It is available in the gallery - just search for "Semantic Highlighter"

Upvotes: 2

Spiralis
Spiralis

Reputation: 3342

I am using dark theme (not light), but I had a very similar problem. My parenthesis, braces and punctuations was black when I started my IDE today, making them just about impossible to see.

I tried to "default" the fonts and colors but that did not help. Neither did changing the settings for Plain Text, Braces or Punctuations.

However, changing from Dark to Light theme and then back to Dark again brought everything back to normal.

Upvotes: 5

Murali Krishna
Murali Krishna

Reputation: 21

To change the Matching Braces TOOLS>OPTIONS>FONTS AND COLORS
Under "Display Items" Select "Braces Matching(Rectangle)" to the color you want.

Upvotes: 0

Youngjae
Youngjae

Reputation: 25050

Visual Studio 2017 still has a problem to have black color as Default color in editor. Generally it's not, but it appeared to black by some reasons.

I changed below two items to Silver and press OK, and open Option again and back to Default it solved.

  • Tools > Options > Fonts and Colors > Display Items : Punctuation
  • Tools > Options > Fonts and Colors > Display Items : Operator

Upvotes: 8

Aashish
Aashish

Reputation: 11

I have changed the color of Parenthesis, Curly Braces and semi-colon by selecting Tools > Options > Environment > Fonts and Colors > Display Items : Operator. Enjoy Coding :)

Upvotes: 0

HamidReza
HamidReza

Reputation: 1934

Tools > Options > Fonts and Colors > Display Items : Punctuation

Upvotes: 28

Kashif
Kashif

Reputation: 459

To change item foreground and background colors in Visual Studio 2010 Ultimate fallow this: Tools->Options->Environment->General->Fonts and Colors. This worked for me to change Brace Matching(Rectangle) from default color which was barley visible, to my own chosen color.

Upvotes: 4

cary yuan
cary yuan

Reputation: 1

Tools > Options > Fonts and Colors >DisplayItem(D:):Parenthesis matching (square brackets) but visual studio 2015 Preview can only changge javascript braces/parenthesis color , C# 貌似不行:(

Upvotes: -1

Beau Harder
Beau Harder

Reputation: 1072

The Visual Studio 2014 CTP 14.0.22129 dark theme blacked-out the brackets and semi-colon for some reason. I was able to fix this by changing the foreground color of the "Punctuation" display item.

Upvotes: 95

John Hunter
John Hunter

Reputation: 4132

I know this is an old already answered question but I found a solution that suited me at least.

Set the "Plain Text" colour to be the colour you want the braces to be then set the "Identifier" colour to be what you want the rest of the text to look like.

Upvotes: 14

jcollum
jcollum

Reputation: 46569

Bah, posted an answer and it got lost. FF and my proxy server aren't getting along.

I think there's no way to just change the color of the parens, they seems to follow the text color. I did find this tool that lets you do all sorts of things with paren color; looked pretty nifty for $49.

Upvotes: 2

Andrew Hare
Andrew Hare

Reputation: 351456

Tools > Options > Fonts and Colors > "Display Items" : Plain Text

Unfortunately this changes a lot more than just braces but its the only way to target them as far as I know.

Upvotes: 7

Orion Edwards
Orion Edwards

Reputation: 123612

As far as I have been able to find, you can't :-(

Upvotes: -1

Related Questions