Skip to content

Commit 7a4b53f

Browse files
LemonBoyandrewrk
authored andcommitted
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 parent 36da8d0 commit 7a4b53f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/std/debug.zig

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,7 @@ const RED = "\x1b[31;1m";
306306
const GREEN = "\x1b[32;1m";
307307
const CYAN = "\x1b[36;1m";
308308
const WHITE = "\x1b[37;1m";
309+
const BOLD = "\x1b[1m";
309310
const DIM = "\x1b[2m";
310311
const 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 });

0 commit comments

Comments
 (0)