Tweak console error/warning print colors#98796
Tweak console error/warning print colors#98796Calinou wants to merge 1 commit intogodotengine:masterfrom
Conversation
- Colorize the "at:" line in the same color as the error/warning, but in a more faint color. - Standardize the console coloring code across platforms (since ANSI escape codes can now be used on Windows).
| // This prevents Godot from writing ANSI escape codes when redirecting | ||
| // stdout and stderr to a file. | ||
| // | ||
| // FIXME: Is there a way to check whether stdout is a TTY on Windows? |
Unfortunately, we don't have control over this if we want a color that looks good on both dark and light themes. Using 256-color or 24-bit colors for this kind of stuff can be a double-edged sword, as you can no longer have a different color between a dark and light theme. With the basic 16 ANSI colors, their exact colors are determined by the terminal theme. This means the theme author can choose colors that look good given the background color (or at least try to). Most of the time, the trace location isn't that important for users either1, so it's not necessarily a bad thing that it becomes less prominent. The source file path can still be Ctrl + clicked for developers who are running Godot from a source repository. Footnotes
|
| // stdout and stderr to a file. | ||
| // | ||
| // FIXME: Is there a way to check whether stdout is a TTY on Windows? | ||
| const char *red = "\E[0;91m"; |
There was a problem hiding this comment.
We should probably avoid using \E as our escape code, as it doesn't actually appear in the standard1. All existing instances can be converted to \x1b or \033 instead, similar to what we use in SCons
| const char *red = "\E[0;91m"; | |
| const char *red = "\x1b[0;91m"; |
Footnotes
|
Can we have a few peeps colour blind check this? As it seems (to my colourblind eyes) really make it hard to read, it's too faint against the dark background. |
|
Dark themes look fine to me, but red in light themes is barely readable. |

Preview
VS Code terminal
Dark theme
Light theme
kitty
Keywords for easier searching: color, terminal, commandline, command line, CLI