How to change the color of a #region in Visual Studio's 2008
Asked Answered
W

4

16

I maybe going mad, but for the life of me I can't find the option to change the colour of collapsed region's in VS2008.

For example if I have the following code:

#region Test Region

CallSomeCode();

#endregion

If I now collapse that region it has the title "Test Region" in a grey text color with a grey box around it.

Warmth answered 8/10, 2009 at 10:38 Comment(0)
A
22

Tools→Options→Environment→Fonts and Colors→Display items[Collapsible text]

Angst answered 8/10, 2009 at 10:41 Comment(3)
Ah, sort of obvious when you say it like that!Warmth
You can't imagine since how much time i'm breaking my eyes with the default color of the collapsible text. It's an happy again developer who thank's you ! hahahMendelssohn
How has no one given @Jaider credit on his comment. That's what worked for me too! +1Prochora
S
17

In VS 2012 the following worked for me:

  • To change color of #region / #endregion - set 'Preprocessor Keyword'
  • To change the text after #region when collapsed- set 'Collapsed Text (Collapsed)'
  • To change the text when expanded - set 'Plain Text', but beware this also changes ; ( [ etc

You may need to restart VS to take effect

Personally I wish there was two types of comments - one for disabling code, and one for explanatory remarks. They are two very different things but generally treated the same in most languages

Subinfeudate answered 20/9, 2013 at 13:2 Comment(1)
For VS2015, to change the text after the #region, set "Preprocessor Text" in Fonts and Colors.Luzern
L
15

For those using VS 2015 that end up here, this is what worked for me in VS 2015:

#region and #endregion Keywords: Preprocessor Keyword [immediately applied]

Text After #region Keyword: Preprocessor Text [immediately applied]

Collapsed Region: Collapsed Text (Collapsed) [must restart Visual Studio]

A Picture

Loutitia answered 16/1, 2017 at 17:29 Comment(1)
Small maybe obvious note, this obviously deals with all preprocessor text like #if Debug. I haven't seen any way to target region and more "passive" without affecting conditionals.Candis
R
1

in VS 2010, it is Tools→Options→Environment→Fonts and Colors→Code Snippet Field

Rappee answered 12/6, 2013 at 6:23 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.