Assuming you’re using the “CMake Tools” VSCode extension, here’s what works for me.
1 – Set CMAKE_COLOR_DIAGNOSTICS to ON in your environment
This makes CMake pass -fcolor-diagnostics to clang. If you build on the command line, you’ll now have color. But the VSCode “output” pane will still be non-colored.
2 – Install the “Output Colorizer” extension from IBM.
This adds color to the Output pane.
It looks like this: