1
3
Fork
You've already forked mibu
0
Pure Zig library for low-level terminal manipulation.
  • Zig 100%
2025年03月18日 16:21:12 +09:00
examples refactoring 2025年03月17日 13:35:44 +09:00
src fixes test 2025年03月18日 16:21:12 +09:00
.gitignore Updated to zig 0.13.0 2024年08月17日 17:15:45 +09:00
build.zig refactoring 2025年03月17日 13:35:44 +09:00
build.zig.zon Updated to zig 0.13.0 2024年08月17日 17:15:45 +09:00
LICENSE first commit 2021年12月29日 16:10:45 -03:00
README.md update zig version 2025年03月01日 13:44:37 +09:00

Warning

This library is a WIP and may have breaking changes and bugs.

mibu

mibu is pure Zig library for low-level terminal manipulation.

Tested with zig version 2024110-mach (0.14.0-dev.2577+271452d22)

Features

  • Allocation free.
  • UTF-8 support.
  • Style (bold, italic, underline, etc).
  • Termios / Raw mode.
  • 8-16 colors.
  • True Color (24-bit RGB).
  • Cursor controls.
  • Clear(Erase) functions.
  • Key events.
  • Partial Mouse events. (Click, Scroll, Release)

How to use

First we add the library as a dependency in our build.zig.zon file with the following command.

zig fetch --save git+https://github.com/xyaman/mibu

And we add it to build.zig file.

constmibu_dep=b.dependency("mibu",.{.target=target,.optimize=optimize,});exe.root_module.addImport("mibu",mibu_dep.module("mibu"));

Now we can use the library in our code.

conststd=@import("std");constmibu=@import("mibu");constcolor=mibu.color;pubfnmain()void{std.debug.print("{s}Hello World in purple!\n",.{color.print.bgRGB(97,37,160)});}

Getting Started

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

TODO

  • Mouse events
    • Left, middle, right click
    • Scroll up, down
    • Release
    • Modifiers (shift, ctrl, alt)
    • Move
    • Click and move (drag)
  • Support all keys events

Projects that use mibu