Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change Clang's colored output

Is it possible to change Clang's choice of colors for their colorized diagnostics?

I like my terminal to have a black background, but I just noticed that I was missing Clang's helpful diagnostic messages. I'm aware of the -fno-color-diagnostics compiler option, but I would prefer to have the colors, just different colors.

I'm using a bash shell in OSX.

like image 478
Nick Desaulniers Avatar asked Nov 16 '25 16:11

Nick Desaulniers


1 Answers

It looks like the colors are hard-coded near the beginning of this file (include file). You can edit the file and recompile the program, write and submit a feature that accepts color settings at the command line, in an environment variable or from a file, or non-portably try to substitute the colors on the fly.

Here is an example of the latter:

clang ... | sed 's/\o33\[30m/\o33[37m/g'

That changes black to white for XTerm escape sequences. Some other sequence would need to be used for other terminal types.

like image 119
Dennis Williamson Avatar answered Nov 18 '25 07:11

Dennis Williamson



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!