23

I searched Tools > Options, but where in VS10 can I turn off or change the default highlighting for the new Razor view on the @nuggets in ASP.NET MVC 3?

3

3 Answers 3

53

Razor only adds one entry to Fonts & Colors, "Razor Code". That controls the background color given to Razor Code nuggets. The rest of the colors are the same as the C#/VB colors. The "@" character itself and Razor keywords like "model" and "section" use the same color as the ASPX "<%" tag ("HTML Server-Side Script", thanks to another Andrew for digging up the specific entry).

If you'd rather we had separate entries for some of these, please email us and suggest that: [email protected]

9
  • 13
    Slight clarification - the @ and other keywords were the HTML Server-Side Script entry under Fonts and Colors. I had a hard time finding it.
    – Andrew
    Nov 3, 2011 at 20:34
  • Edited and credited :). Thanks for closing the loop and posting a comment! Nov 9, 2011 at 23:22
  • 1
    This is exactly what I needed to fix a darker theme =) ... thanks
    – afreeland
    Jun 12, 2012 at 16:46
  • Don't forget to restart VS after you have made the change.
    – Oliver
    Oct 31, 2013 at 15:25
  • 4
    VS2013 appears to have change this from "Razor Code" to "HTML Server Code Block Background".
    – MarkPflug
    Dec 19, 2013 at 17:07
1

The syntax highlighting for razor is based on the c#/VB default highlighting. So you'll have to change those settings to see any changes in a cshtml file highlighting. Might be a good feature request...I don't know.

1

In Visual Studio 2015

Tools -> Options -> Environment -> Font and colors

The name of the property is HTML Razor Code Background Change the Item background to the color you like.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.