40

In Visual Studio we can show white space by CTRL+R, CTRL+W. But how can we change the color of the white space indicator itself?

enter image description here

I would like to change it to a soft gray so it the color is not as strong and not so distracting.

vahid abdi
  • 9,636
  • 4
  • 29
  • 35
JK.
  • 21,477
  • 35
  • 135
  • 214
  • I've added a companion question here: http://stackoverflow.com/questions/35177374/changing-the-color-of-the-whitespace-specifically-for-comments-in-visual-studio to ask specifically what happens if you combine light and dark background at several tokens, as for example comments. – Xavi Montero Feb 03 '16 at 12:41

2 Answers2

66

You can do that in Tools / Options and then Environment / Fonts And Colors and there is a setting for visible White Space :

enter image description here

Antonio Bakula
  • 20,445
  • 6
  • 75
  • 102
13

I was searching on how to do the same on VS code and I ended up on that thread. I found out that you can change it on the settings.json file. This one you can open if you go on Preferences/Settings and search for Color Customizations for the Workbench.

vs code menu option for settings

On the json file accordingly you will need to add (if it's not already there) the next property:

    "workbench.colorCustomizations": {
       "editorWhitespace.foreground": "#1e6d9b"
    },

The color should be a hex code. In the example above I have "#1e6d9b" but feel free to replace it with your preference.

To customize for a specific theme only, use syntax like this, where Monokai is the name of the specific theme you want to override the value for:

"workbench.colorCustomizations": {
    "[Monokai]": {
        "editorWhitespace.foreground": "#1e6d9b"
    }
}

Complete reference on customizing a color theme: https://code.visualstudio.com/docs/getstarted/themes#_customizing-a-color-theme
and theme color properties:
https://code.visualstudio.com/api/references/theme-color

Aaron Wallentine
  • 2,318
  • 24
  • 22
Nasia Makrygianni
  • 761
  • 1
  • 11
  • 19