I can't edit selected text foreground color in

2019-02-16 12:23发布

问题:

Let me show you:

As you can see "Item foreground" is disabled.

I want to believe there's something wrong on my end because being able to choose the colors you use to program in is a basic right for a programmer. No one should ever take that feature away and go unpunished.

回答1:

I just wrote an extension that does this. You can download the extension on the Visual Studio Gallery or directly from the Extension Manager in visual studio (search for my name or the name of the extension, "Selection Foreground").

A few caveats:

  1. I just threw this together, so I don't make any extensive guarantees of correctness.
  2. It uses a different fonts and colors item, named "Selection Foreground", instead of the regular "Selected Text" item. It'll be (alphabetically) towards the bottom.
  3. There will be some amount of performance degradation while changing the selection. This can be improved, but I haven't had time to do so yet.

Also, you can grab the source on github, if you'd like to make any changes.

If you have any comments, you can leave them on my blog. I'll probably write a post about this extension in the next week or so.



回答2:

Seems to be by design because selected areas now retain syntax highlighting:

In light of this new mini-feature, we intentionally disabled the foreground color option for Selected Text in Tools->Options->Environment->Fonts and Colors. Because selected text doesn’t have a single foreground color but instead retains whatever syntax coloring it had when not selected, an option for selected text foreground color doesn’t make sense for Visual Studio 2010. For Beta2, the Tools->Options preview for Selected Text always shows the VS 2008-style white foreground color, which we realize can be confusing.