Crates.io | tui-tools |
lib.rs | tui-tools |
version | 0.1.2 |
source | src |
created_at | 2023-08-08 04:37:54.705863 |
updated_at | 2023-08-12 23:46:52.888192 |
description | A collection of tools for building terminal user interfaces. |
homepage | |
repository | https://github.com/0bject-0bject/tui-tools |
max_upload_size | |
id | 938781 |
size | 7,199 |
Some tools I use for colorizing, and accepting input in a tui applications with minimal dependencies.
Add the following to your Cargo.toml
[dependencies]
tui-tools = "0.1.0"
Colorize a string, enables ansi on windows.
use tui_tools::Colors;
fn main() {
println!("{}", "Hello World!".green());
}
Get input from the user.
use tui_tools::getch;
fn main() {
let input = getch();
println!("You pressed: {}", input as char);
}
Clear the screen.
use tui_tools::cls;
fn main() {
cls();
}