13

I build a project and get some problems in the "Problems view", I click on the problem to see a line of code with that problem highlighted.

And it gets highlighted indeed. However, if dark-styled theme is used, highlight is, for me at least, really hard to notice (line 23 is highlighted):

enter image description here

I guess this color can't be simply hard-coded somewhere since it's different in, for example, red theme and light-styled themes:

enter image description here enter image description here

Is there a way to change this color?

UPD: This question is not a duplicate of "change the error style"; error style (squiggle) applies to all errors at once, my question is about highlighting only the selected error.

Amomum
  • 6,217
  • 8
  • 34
  • 62

3 Answers3

15

Apparently, you can actually change it without using an extension. I created an issue and got the answer that this color is called editor.rangeHighlightBackground and you can override it in your User Settings (settings.json) by:

{
    "workbench.colorCustomizations": {
        "editor.rangeHighlightBackground": "#00AA00"
    }
}

To open User Settings just use Cmd+, on mac or Ctrl+, on windows

Josh Unger
  • 6,717
  • 6
  • 33
  • 55
Amomum
  • 6,217
  • 8
  • 34
  • 62
11

A wrapup answer:

For VS Code 1.52+ You can use this snippet to customize error colors:

"workbench.colorCustomizations": {
     "editorError.background": "#ff80ab66",
     "editorError.foreground": "#d50000",
}

Available properties: https://code.visualstudio.com/api/references/theme-color

Sean
  • 1,055
  • 11
  • 10
5

Check if you can apply a different theme with VSCode 1.52 (Nov. 2020), considering the new feature:

Error background colors

Theme authors can now leverage new theme colors for errors in the editor.

Edior errors, warnings, and infos can now be styled via:

editorError.background
editorWarning.background
editorInfo.background

Error background colors

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • This is cool, I really want to know what is the exact color and alpha value used in the doc. Designers are much better at picking a desirable color. – Sean Dec 18 '20 at 07:03
  • 1
    @Sean From the PR (https://github.com/microsoft/vscode/pull/110112/files), you can see colors in https://github.com/microsoft/vscode/blob/2b9ae05554e2b3105b22d3cf0452ae3b85f1987b/src/vs/platform/theme/common/colorRegistry.ts#L246-L248 – VonC Dec 18 '20 at 07:11