
`-fdiagnostics-color[=WHEN]` `-fno-diagnostics-color`
Use color in diagnostics. WHEN is never, always, or auto. The default depends on how the compiler has been configured, it can be any of the above WHEN
#13444: Disable diagnostic coloring by default -------------------------------------+------------------------------------- Reporter: hvr | Owner: (none) Type: bug | Status: new Priority: high | Milestone: 8.2.1 Component: Compiler | Version: 8.0.1 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: Incorrect Unknown/Multiple | error/warning at compile-time Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- TO my suprise, GHC 8.2.1 enables colors by default which is rather annoying to me as it looks rather ugly with my terminal coloring scheme. This should follow GCC's model instead which defaults them off and allows to customize the coloring scheme via `GCC_COLORS`. Quoting the GCC man- page: options or also never
if GCC_COLORS environment variable isn't present in the environment,
and auto
otherwise. auto means to use color only when the standard error is
a terminal. The
forms -fdiagnostics-color and -fno-diagnostics-color are aliases for `-fdiagnostics-color=always` and `-fdiagnostics-color=never`,
respectively.
The colors are defined by the environment variable `GCC_COLORS`.
Its value is a colon-
separated list of capabilities and Select Graphic Rendition (SGR)
substrings. SGR
commands are interpreted by the terminal or terminal emulator. (See
the section in the
documentation of your text terminal for permitted values and their
meanings as
character attributes.) These substring values are integers in
decimal representation
and can be concatenated with semicolons. Common values to
concatenate include 1 for
bold, 4 for underline, 5 for blink, 7 for inverse, 39 for default
foreground color, 30
to 37 for foreground colors, 90 to 97 for 16-color mode foreground
colors, 38;5;0 to
38;5;255 for 88-color and 256-color modes foreground colors, 49 for
default background
color, 40 to 47 for background colors, 100 to 107 for 16-color mode
background colors,
and 48;5;0 to 48;5;255 for 88-color and 256-color modes background
colors.
The default `GCC_COLORS` is
`error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01`
where 01;31 is bold red, 01;35 is bold magenta, 01;36 is bold cyan,
01;32 is bold green
and 01 is bold. Setting GCC_COLORS to the empty string disables
colors. Supported
capabilities are as follows.
"error=" SGR substring for error: markers.
"warning=" SGR substring for warning: markers.
"note=" SGR substring for note: markers.
"caret=" SGR substring for caret line.
"locus=" SGR substring for location information, file:line or
file:line:column etc.
"quote=" SGR substring for information printed within quotes.
-- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13444 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler