SKY
SKY

Reputation: 13

VSCode doesn't display colors correctly in terminal

How it should be

screenshot showing colored text in terminal

How it is

screenshot showing sections that should be colored wrapped in sequences of "←[{numbers}m"

As you can see, one device doesn't support those colors. VSCode version is 1.70.2 on both devices. The one that doesn't work is Windows 7. I guess that might have something to do with it.

Upvotes: 1

Views: 1582

Answers (1)

Kate Kuehl
Kate Kuehl

Reputation: 1

Enable ANSI Colors in VS Code Settings Force settings.json support ANSI colors.

  1. First navigate to settings.json, there are many ways to do this but here are two simple ones.

Use Command Palette:

Press Ctrl + Shift + P (or Cmd + Shift + P on macOS) to open the Command Palette. Type "Preferences: Open Settings (JSON)" and select it. This will open the settings.json file directly. Using the Settings UI:

You can also manually open it by navigating to: Windows: C:\Users\<YourUsername>\AppData\Roaming\Code\User\settings.json macOS: ~/Library/Application Support/Code/User/settings.json Linux: ~/.config/Code/User/settings.json

  1. Add the following lines to settings.json:

    "terminal.integrated.env.windows": { "TERM": "xterm-256color" }, "terminal.integrated.env.linux": { "TERM": "xterm-256color" }

  2. Save the file

  3. Restart VSCode

  4. Test it out!

Upvotes: 0

Related Questions