How do you turn off Razor highlighting in VS 2013?
Asked Answered
A

6

29

I found a thread: Highlighting kills my Razor syntax in Visual Studio 2010 , asking and explaining how to turn off the highlighting for Razors code.

The problem is, I navigate to: Tools -> Options -> Environment -> Fonts and Colors but the razor option isn't there!

I'm sure I can get used to it, but its rather distracting because I'm still very new with MVC.

This are the options I have:
An example of what I'm seeing with the highlighting and the options

(the picture didn't come out as clear as I thought it would, but the Razor options aren't there!)

Allegraallegretto answered 9/2, 2015 at 6:54 Comment(1)
There is one called "HTML Razor Code Background" which you could tryHotbox
A
66

You have to find Tools -> Options ->Environment -> Fonts and Colors -> HTML Razor Code Background to change it in VS 2013.

Authorized answered 9/2, 2015 at 7:7 Comment(7)
Ohh! There we go! Thank you so much, can carry on with my project now!Allegraallegretto
Also valid for VS 2015Oxidize
Also valid for VS 2017Sweepings
Also valid for VS 2019 PreviewIncult
To complete this answer, you need to change the Item background to a color. Since I had a black theme black worked well and was easy to read. If using the standard white theme try the white color.Hat
I can't find that HTML Razor setting in Fonts and colors - has it been moved in VS 2019 16.5?Arredondo
For some reason with Blazor, in VS 2022, it was Razor C# Code TransitionSecure
G
9

Although the instructions on the accepted answer takes you to the correct settings that needs to be adjusted, it took a while for me to adjust the settings. So for those like me, the key is to change the Item Background property of the HTML Razor Code Background, but the background color you need to choose should be the same as that of Plain Text (the first item in Display Items list). Since I use dark theme, that default color of Plain Text wasn’t available for HTML Razor Code Background. So I had to go Custom… copy the color settings from Plain Text, and then got HTML Razor Code Background, Custom… and plugin those color setting number and now that highlight is gone!

Greenbrier answered 21/12, 2016 at 16:22 Comment(1)
Or you could just select Automatic and it 'automatically' changes to match the theme background you are currently using..Socio
M
4

Please see option that starts with HTML (i know its not obvious but does the trick).

alt text

Monarchist answered 9/2, 2015 at 7:8 Comment(0)
G
0

Combining Mateusz Rogulski & goku_da_master's answers, this worked for me:

  1. Go to Tools -> Options ->Environment -> Fonts and Colors -> HTML Razor Code Background
  2. For a dark theme, change Item background to Black, if it isn't already
  3. For a dark theme, change Item foreground to White
Gasp answered 3/2, 2020 at 13:10 Comment(0)
K
0

As an addition to Mateusz Rogulski & goku_da_master's answers, if you select Automatic for the Item background instead of Black (for dark theme), the setting will continue to work if you change the VS theme.

Keyway answered 26/4, 2020 at 21:17 Comment(0)
T
0

In Visual Studio 2022 the display item is now called 'Razor Code Background'.

Telescopic answered 24/6 at 17:10 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.