-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tweak console error/warning print colors #98796
base: master
Are you sure you want to change the base?
Tweak console error/warning print colors #98796
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? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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