Fix the color of compiler messages for light-themed terminal.
This commit is contained in:
parent
76f3bdfff8
commit
fea016afc0
@ -24,20 +24,20 @@ static void print_err_msg_type(ErrorMsg *err, ErrColor color, ErrType err_type)
|
|||||||
bool is_tty = os_stderr_tty();
|
bool is_tty = os_stderr_tty();
|
||||||
if (color == ErrColorOn || (color == ErrColorAuto && is_tty)) {
|
if (color == ErrColorOn || (color == ErrColorAuto && is_tty)) {
|
||||||
if (err_type == ErrTypeError) {
|
if (err_type == ErrTypeError) {
|
||||||
os_stderr_set_color(TermColorWhite);
|
os_stderr_set_color(TermColorBold);
|
||||||
fprintf(stderr, "%s:%" ZIG_PRI_usize ":%" ZIG_PRI_usize ": ", path, line, col);
|
fprintf(stderr, "%s:%" ZIG_PRI_usize ":%" ZIG_PRI_usize ": ", path, line, col);
|
||||||
os_stderr_set_color(TermColorRed);
|
os_stderr_set_color(TermColorRed);
|
||||||
fprintf(stderr, "error:");
|
fprintf(stderr, "error:");
|
||||||
os_stderr_set_color(TermColorWhite);
|
os_stderr_set_color(TermColorBold);
|
||||||
fprintf(stderr, " %s", text);
|
fprintf(stderr, " %s", text);
|
||||||
os_stderr_set_color(TermColorReset);
|
os_stderr_set_color(TermColorReset);
|
||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
||||||
} else if (err_type == ErrTypeNote) {
|
} else if (err_type == ErrTypeNote) {
|
||||||
os_stderr_set_color(TermColorWhite);
|
os_stderr_set_color(TermColorBold);
|
||||||
fprintf(stderr, "%s:%" ZIG_PRI_usize ":%" ZIG_PRI_usize ": ", path, line, col);
|
fprintf(stderr, "%s:%" ZIG_PRI_usize ":%" ZIG_PRI_usize ": ", path, line, col);
|
||||||
os_stderr_set_color(TermColorCyan);
|
os_stderr_set_color(TermColorCyan);
|
||||||
fprintf(stderr, "note:");
|
fprintf(stderr, "note:");
|
||||||
os_stderr_set_color(TermColorWhite);
|
os_stderr_set_color(TermColorBold);
|
||||||
fprintf(stderr, " %s", text);
|
fprintf(stderr, " %s", text);
|
||||||
os_stderr_set_color(TermColorReset);
|
os_stderr_set_color(TermColorReset);
|
||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
||||||
|
@ -931,6 +931,7 @@ int os_self_exe_path(Buf *out_path) {
|
|||||||
#define VT_GREEN "\x1b[32;1m"
|
#define VT_GREEN "\x1b[32;1m"
|
||||||
#define VT_CYAN "\x1b[36;1m"
|
#define VT_CYAN "\x1b[36;1m"
|
||||||
#define VT_WHITE "\x1b[37;1m"
|
#define VT_WHITE "\x1b[37;1m"
|
||||||
|
#define VT_BOLD "\x1b[0;1m"
|
||||||
#define VT_RESET "\x1b[0m"
|
#define VT_RESET "\x1b[0m"
|
||||||
|
|
||||||
static void set_color_posix(TermColor color) {
|
static void set_color_posix(TermColor color) {
|
||||||
@ -947,6 +948,9 @@ static void set_color_posix(TermColor color) {
|
|||||||
case TermColorWhite:
|
case TermColorWhite:
|
||||||
fprintf(stderr, VT_WHITE);
|
fprintf(stderr, VT_WHITE);
|
||||||
break;
|
break;
|
||||||
|
case TermColorBold:
|
||||||
|
fprintf(stderr, VT_BOLD);
|
||||||
|
break;
|
||||||
case TermColorReset:
|
case TermColorReset:
|
||||||
fprintf(stderr, VT_RESET);
|
fprintf(stderr, VT_RESET);
|
||||||
break;
|
break;
|
||||||
@ -989,6 +993,7 @@ void os_stderr_set_color(TermColor color) {
|
|||||||
SetConsoleTextAttribute(stderr_handle, FOREGROUND_GREEN|FOREGROUND_BLUE|FOREGROUND_INTENSITY);
|
SetConsoleTextAttribute(stderr_handle, FOREGROUND_GREEN|FOREGROUND_BLUE|FOREGROUND_INTENSITY);
|
||||||
break;
|
break;
|
||||||
case TermColorWhite:
|
case TermColorWhite:
|
||||||
|
case TermColorBold:
|
||||||
SetConsoleTextAttribute(stderr_handle,
|
SetConsoleTextAttribute(stderr_handle,
|
||||||
FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_BLUE|FOREGROUND_INTENSITY);
|
FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_BLUE|FOREGROUND_INTENSITY);
|
||||||
break;
|
break;
|
||||||
|
@ -21,6 +21,7 @@ enum TermColor {
|
|||||||
TermColorGreen,
|
TermColorGreen,
|
||||||
TermColorCyan,
|
TermColorCyan,
|
||||||
TermColorWhite,
|
TermColorWhite,
|
||||||
|
TermColorBold,
|
||||||
TermColorReset,
|
TermColorReset,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user