How to change color of selected references - visual-studio

Visual Studio 2010 highlights all references to the same variable (or class) when your cursor is placed over it.
with the theme I use highlighted references are white on white - making them virtually impossible to read. what is the name of "display item" in Options-> Environment Fonts and Colors that is responsible for that color?
changing Plain Text to a darker one partially solves an issue however that also changes color for lots of other stuff on a screen, so ideally would be to change a background for this type of "selection"..

There's one called "Highlighted Reference". You can only change the background color, I believe.

Related

What's the name of the bar below the Property grid in VS?

I'm using the Visual Studio Color Theme Editor extension to help darken up VS2010, found a nice theme that I like however I've got one big problem with it.
On the Property sheet, at the bottom where it says the name of the property and a sort description this theme I'm using is impossible to read; Black on a dark grey background. Unfortunately, I don't know what this specific segment of the Property window is called to change it.
You can not change the text color with the extension.
To figure that out, copy FFFFFF, select all line in the theme editor configuration pane (with Shift), press Ctrl+V (yes, you can do that, pretty neat !) and hit apply : everything that can be themed will then appear white. The text however, will stay black.
You can hopefully change the background color : It's called ToolWindowBackground. It will affect all tool windows of course. There's no specific item for this window in particular.

Change text color for Selected Text in Visual Studio [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
I can't edit selected text foreground color in Visual Studio 2010. Anyone know how to do this?
In the Options->Environment->Fonts and Colors dialog you can choose Selected Text in the Display Items listbox, but this only allows you to change the Item background property.
How does one change the text color, so that for example I can have white text on a blue background when I select an item? Also, is there a way to bold the text (the Bold box is disabled also).
Note: Here is the question that asks about the background color change.
The foreground color in the VS2010 editor is not set in one place but in many within the Options Form. If you have Resharper installed it also sets some foreground properties. The reason VS2010 does this is to allow individual items (words) within the foreground to express different colors depending on their type (e.g. comments, value types, enums etc.) even when they are selected. In other words VS2010 applies a priority to the foreground color for these specific types over the generic selected text color format.
For instance, when you look at the Fonts and Colors dialog you will notice the entry for User Types. On my VS2010 its RGB value is RGB(43, 145, 175) which looks like teal. If I change that color to Red, the User Types on my editor's foreground color changes to Red and remains Red even when with the selection area.
In some instances VS2010 will override the foreground color such as applying a breakpoint to a line. On my VS2010 enabled breakpoints when in editing mode have a white foreground color, regardless of the terms in the line.
To answer your question of how one would change the foreground color for all selected text, VS2010 does not support this out of the box.
I wrote a VS2010 Extension as outlined here. I used the example code as is and added the lines:
selectedText[EditorFormatDefinition.ForegroundBrushId] = Brushes.Green;
formatMap.SetProperties("Selected Text", selectedText);
...but this did not change the foreground color of selected text to green. It stayed black. This is probably due to the VS2010 WPF editor using a Priority Order for each format and one or more other formats overriding the selected text foreground color.
Have you tried setting the colors on the 'Highlighted Reference' option in the Fonts and Colors window?
There is no individual setting for the Selected Text Foreground properties, it uses the Plain Text Settings for the Foreground in the Options Form, but this will only work for normal text, the Foreground colors for Properties, Comments and other specialty colored text will remain the same, there is no overriding Foreground color that can be used for all items.

How to locate the formatting of a line in the Options/Fonts and Colors dialog?

I am using Resharper 6.x with VS2010. One of the features is that if you double click on a variable, it is highlighted and then other usages of the variable are highlighted, like so:
The background and foreground colors of the highlighted variable are too close to each other and I am trying to change it in the Options/Fonts and Colors dialog. It has a small Sample window (below). I've gone through the entire list of display items and can't find the one matching what I see in the coding window.
So 2 questions:
Which display item should I change to affect the back/fore colors of the highlighted variables?
Is there some tool that that will point me to the display item in question for any piece of code?
P.S. I am using the Ragnarok as my base color theme.
P.P.S. This may have nothing to do with Resharper. I turned it off and the coloring was still there. I guess my original question still stands - how to affect the colors of the highlighted variables.
Visual Studio 2010 Reference Highlighting
As you already presumed: The reference highlighting of current selection is not a ReSharper feature but a VS 2010 feature. So you need to look at VS items in Fonts and Colors dialog.
The right display item is Highlighted Reference.
ReSharper Reference Highlighting
ReSharper's equivalent is Highlight usages in file by pressing Shift+Alt+F11.
Then all read references have light blue background color (related display item in Fonts and Colors dialog is ReSharper Read Usage).
And all write references have rose background color (related display item in Fonts and Colors dialog is ReSharper Write Usage).
But the disadvantage of ReSharper's reference highlighting is that you need to press a shortcut. VS does the highlighting automatically.

Highlighted Text background and foreground - How to change?

Here is my scenario. I like my color scheme. I have a dark blue background with light grey text. I have the Plain Text option in VS 2010 in Tools | Options | Environment | Fonts and Colors set to be a dark grey for the foreground and dark blue for the background:
alt text http://www.elbalazo.net/post/vs_plaintext_color.jpg
But I need to fix this major problem/annoyance which is when I highlight some text and then lost focus with my mouse it turns almost completely white!
alt text http://www.elbalazo.net/post/WhiteBackgroundVS2.jpg
And worse, when I mouse over the little section lines of code on the left, the selection of the entire editor goes white with a light grey foreground for text:
alt text http://www.elbalazo.net/post/WhiteBackgoundVS.jpg
Not able to figure out where and how to fix this. I don't see a way. Note: I'm using R# 5.0+ so I don't know if that has anything to do with this color issue or what...maybe it's overriding some VS stuff or this is just a VS issue I don't know..probably just not looking in the right area under Fonts and colors...but a lot of the item foreground elements are read only.
UPDATED:
I think it might be (not sure) this one but I can't test it as the foreground is locked and not editable:
alt text http://www.elbalazo.net/post/vs_brachmatching_color.jpg
I'm pretty sure your first problem can be solved by setting the colors on the 'Highlighted Reference' option in the Fonts and Colors window. If ReSharper is override this setting I couldn't tell you. I don't have it installed on this machine. As for your second problem I have no idea.
If you get too irritated at trying to figure out the color options you could also try Studio Styles for pre-made ones. I believe that is where I got the one I use currently.
I believe the setting you are looking for is "Inactive Selected Text". Found while trying to figure out why my selected search texts were not highlighted in an obvious manner.
Might be a year late... answering for future searches.
ReSharper is indeed overriding some of your settings, but those settings can be found in the same screen, towards the bottom of the listbox.
In Tools | Options | Environment | Fonts and Colors, scroll to the bottom of the 'Display Items:' listbox, and you should see a series of settings that start with ReSharper. For instance, the 'ReSharper Current Line Highlight` was causing me issues when I changed my theme to use a dark background.
Hope that helps.
The highlight for matching references is the "Highlighted Reference" background color (as Sean Copenhaver pointed out).
The highlight for the outlining region hover is "Collapsed Region" (as Brandon Satrom pointed out in his comment on the original question). The foreground color is the color used in the outlining margin and the background color is the color used under the text. You can also disable that highlight by disabling Tools->Options->Environment->General->Enable rich client visual experience, though that will disable other things (animations, gradients, etc.)
The brace matching rectangle is the highlight that appears when you insert or put the caret on a brace (e.g. ")", "]", "}"). It only lets you override the background color because you can't use it to change the foreground (text) color.
I had this same problem (much later) with VS 2010 and R# 7.1.
Disable the "Highlight current line" option in ReSharper > Options > Environment > Editor.
That option, when enabled, causes the VS 2010 color options for Highlighted Reference to not apply.
FWIW I had this problem without ReSharper and in my case tracked it down to the Brace Matching (Rectangle) color setting which looked nothing like what I was seeing in the editor but allowed me to fix the issue anyway.
So this is weird but I was having the same problem and it simply went away when I went to Tools->Options->Environment->Fonts and Colors and changed the font size to 18. I then went back in the same menu and changes it back to 10 (default) and the editor no longer highlights the collapsible regions white. Strange behavior.

How to make selection color be "on top" when background color for any text element is set in Visual Studio 2010 editor

Faced problem while setting background color for any element in Visual Studio 2010 editor. Selection color doesn't override this background color. So then it's very inconvenient to work with selections in editor.
Case when only string literal is selected it's almost impossible to distinguish colors and see what part of string is selected.
Is there any possibility to fix the problem by changing some options? Or it's a Visual Studio bug?
This is new VS2010 behavior which unfortunately is deliberate. However, Noah Richards (from the editor team) has written a couple of extensions that help mitigate the new behavior:
The first is an extension that draws a border around the selection (the main feature of the extension is a gradient background, but the border is what makes it really useful for me).
Second is an extension to change Selection Foreground color.

Resources