visual-studio 突出显示的文本背景和前景 - 如何更改?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3453331/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-22 12:20:35  来源:igfitidea点击:

Highlighted Text background and foreground - How to change?

visual-studiovisual-studio-2010

提问by PositiveGuy

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:

这是我的场景。我喜欢我的配色方案。我有一个带有浅灰色文本的深蓝色背景。我在工具中的 VS 2010 中有纯文本选项 | 选项 | 环境 | 字体和颜色设置为前景深灰色和背景深蓝色:

alt text http://www.elbalazo.net/post/vs_plaintext_color.jpg

替代文字 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

替代文字 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

替代文字 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.

无法弄清楚在哪里以及如何解决这个问题。我没有办法。注意:我使用的是 R# 5.0+,所以我不知道这是否与这个颜色问题或什么有关......也许它覆盖了一些 VS 的东西,或者这只是一个我不知道的 VS 问题。 .可能只是没有查看字体和颜色下的正确区域...但是很多项目前景元素都是只读的。

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

替代文字 http://www.elbalazo.net/post/vs_brachmatching_color.jpg

回答by Sean Copenhaver

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.

我很确定您的第一个问题可以通过在“字体和颜色”窗口中的“突出显示参考”选项上设置颜色来解决。如果 ReSharper 覆盖此设置,我无法告诉您。我没有在这台机器上安装它。至于你的第二个问题,我不知道。

If you get too irritated at trying to figure out the color options you could also try Studio Stylesfor pre-made ones. I believe that is where I got the one I use currently.

如果您对尝试找出颜色选项感到太恼火,您也可以尝试使用Studio Styles来制作预制的颜色选项。我相信这就是我得到我目前使用的那个的地方。

回答by ObjectType

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.

可能晚了一年......回答未来的搜索。

回答by Brandon Satrom

ReSharper is indeed overriding some of your settings, but those settings can be found in the same screen, towards the bottom of the listbox.

ReSharper 确实覆盖了您的某些设置,但可以在同一屏幕中的列表框底部找到这些设置。

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.

在 中Tools | Options | Environment | Fonts and Colors,滚动到“显示项目:”列表框的底部,您应该会看到一系列以 开头的设置ReSharper。例如,当我将主题更改为使用深色背景时,“ReSharper Current Line Highlight”导致了我的问题。

Hope that helps.

希望有帮助。

回答by Noah Richards

The highlight for matching references is the "Highlighted Reference" background color (as Sean Copenhaver pointed out).

匹配参考的亮点是“突出显示的参考”背景颜色(正如 Sean Copenhaver 指出的那样)。

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.)

大纲区域悬停的亮点是“折叠区域”(正如 Brandon Satrom 在他对原始问题的评论中指出的那样)。前景色是轮廓边距中使用的颜色,背景色是文本下方使用的颜色。您还可以通过 disable 来禁用该突出显示Tools->Options->Environment->General->Enable rich client visual experience,尽管这会禁用其他内容(动画、渐变等)

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.

大括号匹配矩形是在大括号上插入或放置插入符号时出现的突出显示(例如“)”、“]”、“}”)。它只允许您覆盖背景颜色,因为您不能使用它来更改前景色(文本)颜色。

回答by JYelton

I had this same problem (much later) with VS 2010 and R# 7.1.

我在 VS 2010 和 R# 7.1 上遇到了同样的问题(很久以后)。

Disable the "Highlight current line" option in ReSharper > Options > Environment > Editor.

禁用中的“突出显示当前行”选项ReSharper > Options > Environment > Editor

That option, when enabled, causes the VS 2010 color options for Highlighted Referenceto not apply.

该选项在启用时会导致 VS 2010 颜色选项Highlighted Reference不适用。

回答by futuresandwich

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.

FWIW 我在没有 ReSharper 的情况下遇到了这个问题,在我的情况下,Brace Matching (Rectangle)将其追溯到颜色设置,这看起来与我在编辑器中看到的完全不同,但无论如何我都可以解决这个问题。

回答by JHowIX

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.

所以这很奇怪,但我遇到了同样的问题,当我转到工具->选项->环境->字体和颜色并将字体大小更改为 18 时,它就消失了。然后我回到同一个菜单并进行更改它回到 10(默认),编辑器不再将可折叠区域高亮显示为白色。奇怪的行为。