diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/std/io/tty.zig | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/lib/std/io/tty.zig b/lib/std/io/tty.zig index c220e87880..1e9cd0d9bc 100644 --- a/lib/std/io/tty.zig +++ b/lib/std/io/tty.zig @@ -71,12 +71,9 @@ pub const Config = union(enum) { reset_attributes: u16, }; - pub fn setColor( - conf: Config, - writer: anytype, - color: Color, - ) (@typeInfo(@TypeOf(writer.writeAll(""))).error_union.error_set || - windows.SetConsoleTextAttributeError)!void { + pub const SetColorError = std.os.windows.SetConsoleTextAttributeError || std.io.Writer.Error; + + pub fn setColor(conf: Config, w: *std.io.Writer, color: Color) SetColorError!void { nosuspend switch (conf) { .no_color => return, .escape_codes => { @@ -101,7 +98,7 @@ pub const Config = union(enum) { .dim => "\x1b[2m", .reset => "\x1b[0m", }; - try writer.writeAll(color_string); + try w.writeAll(color_string); }, .windows_api => |ctx| if (native_os == .windows) { const attributes = switch (color) { |
