如何为在 Windows 终端上运行的 MSYS2 安装设置 GCC 输出颜色?

huangapple go评论61阅读模式
英文:

how to set gcc output colors for msys2 installation running on windows terminal?

问题

I've just updated gcc to 13.1 (ucrt version) from the msys2 distribution on windows 10; I use it on the old windows terminal. While compiling I've realized that it gives some hardly distinguishable color in part of the error message (a dark purple on black background). Changing the background color in the terminal doesn't solve, because gcc forces somehow the background color of its output lines to black.

I've seen on this post: https://stackoverflow.com/questions/5732562/improving-g-output that I can set the colors with the GCC_COLORS variable. But how do I set it from my environment (windows terminal with gcc 13.1 from msys2)?

I've also tried with a command like this in the windows terminal:

setx GCC_COLORS "error=01;30:warning=01;34:note=01;33:caret=01;31:locus=01:quote=01"

but it doesn't seem to affect gcc's output.

Please note that:

  • I don't want to use clang; this question is about gcc
  • I don't want to use powershell; this question is about windows terminal
  • I have windows 10, not 11
  • I also use linux and compile on it too, but for this question I'm interested in the windows environment.
英文:

I've just updated gcc to 13.1 (ucrt version) from the msys2 distribution on windows 10; I use it on the old windows terminal. While compiling I've realized that it gives some hardly distinguishable color in part of the error message (a dark purple on black background). Changing the background color in the terminal doesn't solve, because gcc forces somehow the background color of its output lines to black.

如何为在 Windows 终端上运行的 MSYS2 安装设置 GCC 输出颜色?

I've seen on this post :
https://stackoverflow.com/questions/5732562/improving-g-output
that I can set the colors with the GCC_COLORS variable. But how do I set it from my environment (windows terminal with gcc 13.1 from msys2) ?
I've also tried with a command like this in the windows terminal:

setx GCC_COLORS "error=01;30:warning=01;34:note=01;33:caret=01;31:locus=01:quote=01"

but it doesn't seem to affect gcc's output.

Please note that:

  • I don't want to use clang; this question is about gcc

  • I don't want to use powershell; this question is about windows terminal

  • I have windows 10, not 11

  • I also use linux and compile on it too, but for this question I'm interested in the windows environment.

答案1

得分: 1

我可能会在终端设置中选择一个不同的配色方案。看起来默认的“深洋红色底黑色字”对比度不太好。内置的“一半深色”方案看起来好一些。

或者,如果你想真正自定义外观,可以在 https://github.com/mbadolato/iTerm2-Color-Schemes 找到很多好的配色方案。

英文:

I'd probably just pick a different color scheme in the Terminal settings. Looks like the default "dark magenta on black" contrast just isn't all that good. The built-in "One Half Dark" scheme looks a bit better.

Or if you want to really customize the look, there are TONS of good schemes over at https://github.com/mbadolato/iTerm2-Color-Schemes

huangapple
  • 本文由 发表于 2023年5月6日 19:39:00
  • 转载请务必保留本文链接:https://go.coder-hub.com/76188660.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定