Question: Is there a way to display colors (like in a terminal) in the Debug Console of Visual Studio Code (Version 1.10.2) when debugging node.js code?

Answer: 
See @ <https://stackoverflow.com/a/55493884/3645650> for lore and roleplay.

Here is just a no brain answer.

|  | Versions |
| --- | --- |
| Tested up to | Visual Studio Code May 2021 (version `1.63`) |

### Text

```
console.log( "\u001b[1;31m Red message" );
console.log( "\u001b[1;32m Green message" );
console.log( "\u001b[1;33m Yellow message" );
console.log( "\u001b[1;34m Blue message" );
console.log( "\u001b[1;35m Purple message" );
console.log( "\u001b[1;36m Cyan message" );

```

### Background

```
console.log( "\u001b[1;41m Red background" );
console.log( "\u001b[1;42m Green background" );
console.log( "\u001b[1;43m Yellow background" );
console.log( "\u001b[1;44m Blue background" );
console.log( "\u001b[1;45m Purple background" );
console.log( "\u001b[1;46m Cyan background" );

```

### Reset

```
console.log( "\u001b[0m Reset text and background color/style to default" );

```

### Example

```
console.log( "\u001b[1;31m --process: Error" + "\u001b[0m" );

```
Here's a little utility I wrote based on the answers here (and some googling):

```js
export const colored_console = {
  /**
   * @param color red | green | yellow | blue | purple | cyan | red_bg | green_bg | blue_bg | purple_bg | cyan_bg | yellow_bg | white_bg
   * @param args things you want to log
   */
  log: function(color, ...args) {
    // adjust text color
    if      (color === 'red'      ) { console.log(`\u001b[31m`, ...args, `\u001b[0m`) }
    else if (color === 'green'    ) { console.log(`\u001b[32m`, ...args, `\u001b[0m`) }
    else if (color === 'yellow'   ) { console.log(`\u001b[33m`, ...args, `\u001b[0m`) }
    else if (color === 'blue'     ) { console.log(`\u001b[34m`, ...args, `\u001b[0m`) }
    else if (color === 'purple'   ) { console.log(`\u001b[35m`, ...args, `\u001b[0m`) }
    else if (color === 'cyan'     ) { console.log(`\u001b[36m`, ...args, `\u001b[0m`) }
    // adjust bg color
    else if (color === 'red_bg'   ) { console.log(`\u001b[41m`, ...args, `\u001b[0m`) }
    else if (color === 'blue_bg'  ) { console.log(`\u001b[44m`, ...args, `\u001b[0m`) }
    else if (color === 'purple_bg') { console.log(`\u001b[45m`, ...args, `\u001b[0m`) }
    else if (color === 'cyan_bg'  ) { console.log(`\u001b[46m`, ...args, `\u001b[0m`) }
    // adjust text and bg color for better visibility
    else if (color === 'green_bg' ) { console.log(`\u001b[42m\u001b[34m`, ...args, `\u001b[0m`) }
    else if (color === 'yellow_bg') { console.log(`\u001b[43m\u001b[34m`, ...args, `\u001b[0m`) }
    else if (color === 'white_bg' ) { console.log(`\u001b[47m\u001b[34m`, ...args, `\u001b[0m`) }
    // if you didn't specify a color, log everything with default color
    else                            { console.log(color, ...args) }
  }
}

```

...and here's some further reading I found useful:

[Google Search: ANSI colors](https://www.google.com/search?q=ANSI%20colors) (check out the image results)

[Wikipedia: ANSI escape code](https://en.wikipedia.org/wiki/ANSI_escape_code)