xyaman/mibu
Pure Zig library for low-level terminal manipulation: zero heap allocations, UTF-8 support, text styling, color output, cursor and screen control, key...
mibu is a pure Zig library for low-level terminal manipulation.
Status: This library is in beta. Breaking changes may occur.
Tested with zig version
0.15.1
(release)
Add the library as a dependency in your build.zig.zon
file:
zig fetch --save git+https://github.com/xyaman/mibu
Import the dependency in your build.zig
file:
const mibu_dep = b.dependency("mibu", .{});
exe.root_module.addImport("mibu", mibu_dep.module("mibu"));
Use the library in your Zig code:
const std = @import("std");
const mibu = @import("mibu");
const color = mibu.color;
pub fn main() void {
std.debug.print("{s}Hello World in purple!\n", .{color.print.bgRGB(97, 37, 160)});
}
See the examples directory.
You can run the examples with the following command:
# Prints text with different colors
zig build color
# Prints what key you pressed, until you press `q` or `ctrl+c`
zig build event
zig build alternate_screen
Mouse: Click and move (drag)
mibu