dayvster/tintz
Minimal Zig library for coloring and styling terminal output with ANSI escape codes.
Minimal Zig library for coloring and styling terminal output with ANSI escape codes.
Installation
Fetch the package with Zig:
zig fetch --save git+https://github.com/dayvster/tintz
Then add it as a module in your build.zig:
const tintz_mod = b.addModule("tintz", .{
.root_source_file = b.path("src/root.zig"),
.target = target,
});
Then import the module in your Zig code:
const tintz = @import("tintz");
Add src/tintz.zig to your Zig project and import via your build system or module path.
const tintz = @import("tintz");
var buf: [128]u8 = undefined;
const styled = try tintz.tintz(
tintz.Style{ .fg = tintz.Color.red, .bold = true },
"Hello, world!",
&buf,
);
try std.fs.File.stdout().writeAll(styled);
See examples/basic.zig for more usage patterns and style combinations.
MIT