Search code examples
visual-studio-codecolorsthemes

How can I change the color of code blocks in rendered markdown in VS Code?


I'm creating a theme for VS Code and I've already added all the colors I wanted to customize except one. On the extensions page, a specific color I couldn't find in the official VSCode documentation https://code.visualstudio.com/api/references/theme-color

What is the code for this field?

In the settings.json file it would look like this:

{
   "workbench.colorCustomizations": {
     "COLOR-CODE": "#00AA00"
   }
}

What would that COLOR-CODE be?

How to change this background color of texts that are as a code block

I already tried several codes that are available at https://code.visualstudio.com/api/references/theme-color but without success

I also tried calling the "Developer: Inspect Editor Tokens and Scopes" tool but it doesn't work on the extensions page


Solution

  • This is supposed to be possible by using the textCodeBlock.background colour customization point. See also [theme] add text colors #26298, where the feature was requested / described.

    It currently is bugged. I raised an issue ticket concerning this and suggesting how to fix it on VS Code's GitHub repo at Code blocks in Markdown preview don't use textCodeBlock.background #179219. A commit has been made to fix the issue. I assume the fix will be made available in the next release (VS Code 1.78).