authorgravatar for thatlemon@gmail.comLemonBoy <thatlemon@gmail.com> 2021-05-15 09:59:22+02:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-05-15 13:44:52-04:00
log7a4b53fdee89f2d61cedbb3cef3bda24dacf2a57
treee8bf09f0d0ef5196823eb9df5d2ac6882a0955ef
parent36da8d02b56e06c92279b4df21fbfaa0273e6c7b

std: Avoid using white color when printing stacktraces

Use .bold instead of .white, the effect is the same for light-on-dark terminals but greatly improves the readability for dark-on-light ones. Closes #8761

1 files changed, 4 insertions(+), 2 deletions(-)

lib/std/debug.zig+4-2
......@@ -306,6 +306,7 @@ const RED = "\x1b[31;1m";
306306const GREEN = "\x1b[32;1m";
307307const CYAN = "\x1b[36;1m";
308308const WHITE = "\x1b[37;1m";
309const BOLD = "\x1b[1m";
309310const DIM = "\x1b[2m";
310311const RESET = "\x1b[0m";
311312
......@@ -476,8 +477,9 @@ pub const TTY = struct {
476477 .Red => out_stream.writeAll(RED) catch return,
477478 .Green => out_stream.writeAll(GREEN) catch return,
478479 .Cyan => out_stream.writeAll(CYAN) catch return,
479 .White, .Bold => out_stream.writeAll(WHITE) catch return,
480 .White => out_stream.writeAll(WHITE) catch return,
480481 .Dim => out_stream.writeAll(DIM) catch return,
482 .Bold => out_stream.writeAll(BOLD) catch return,
481483 .Reset => out_stream.writeAll(RESET) catch return,
482484 },
483485 .windows_api => if (builtin.os.tag == .windows) {
......@@ -629,7 +631,7 @@ fn printLineInfo(
629631 comptime printLineFromFile: anytype,
630632) !void {
631633 nosuspend {
632 tty_config.setColor(out_stream, .White);
634 tty_config.setColor(out_stream, .Bold);
633635
634636 if (line_info) |*li| {
635637 try out_stream.print("{s}:{d}:{d}", .{ li.file_name, li.line, li.column });