termint
Rust library for colored printing and Terminal User Interfaces
Installation:
This library is available on crates.io. You can add it to your projects using cargo:
cargo add termint
Basic example:
Printing colored text is really easy, you can do it like this:
println!;
println!;
println!;
println!;
You can see all the colors and modifiers in the documentation.
Advanced example:
You can also create TUIs using this library. This example shows how you can use Block widget and add children to it and creating Layout:
// Creates main block and sets its properties
let mut main = new
.title
.direction
.border_type;
// Creates block1 and adds span as its child
let mut block1 = new.title;
let span1 = "I like it!".fg.bg;
block1.add_child;
// Adds block1 as child of main block
main.add_child;
// Create block2 and adds span as its child
let mut block2 = new.title;
let span2 = "This is really cool, right?".fg;
block2.add_child;
// Adds block2 as child of main block
main.add_child;
// Renders the main block which renders all the children
main.render;
Usage:
Code blocks above are just examples of the usage. To see more about functions, Widgets and more, please visit the documentation.
Technologies
Obviously this library was created in Rust, but I also used library called term_size to get terminal size.
Links
- Author: Martan03
- GitHub repository: termint
- Package: crates.io
- Documentation: docs.rs
- Author website: martan03.github.io