| ... | @@ -70,7 +70,12 @@ pub const Config = union(enum) { | ... | @@ -70,7 +70,12 @@ pub const Config = union(enum) { |
| 70 | reset_attributes: u16, | 70 | reset_attributes: u16, |
| 71 | }; | 71 | }; |
| 72 | | 72 | |
| 73 | pub fn setColor(conf: Config, out_stream: anytype, color: Color) !void { | 73 | pub fn setColor( |
| | 74 | conf: Config, |
| | 75 | writer: anytype, |
| | 76 | color: Color, |
| | 77 | ) (@typeInfo(@TypeOf(writer.writeAll(""))).ErrorUnion.error_set || |
| | 78 | windows.SetConsoleTextAttributeError)!void { |
| 74 | nosuspend switch (conf) { | 79 | nosuspend switch (conf) { |
| 75 | .no_color => return, | 80 | .no_color => return, |
| 76 | .escape_codes => { | 81 | .escape_codes => { |
| ... | @@ -95,7 +100,7 @@ pub const Config = union(enum) { | ... | @@ -95,7 +100,7 @@ pub const Config = union(enum) { |
| 95 | .dim => "\x1b[2m", | 100 | .dim => "\x1b[2m", |
| 96 | .reset => "\x1b[0m", | 101 | .reset => "\x1b[0m", |
| 97 | }; | 102 | }; |
| 98 | try out_stream.writeAll(color_string); | 103 | try writer.writeAll(color_string); |
| 99 | }, | 104 | }, |
| 100 | .windows_api => |ctx| if (native_os == .windows) { | 105 | .windows_api => |ctx| if (native_os == .windows) { |
| 101 | const attributes = switch (color) { | 106 | const attributes = switch (color) { |