#tui #user-interface #ansi #terminal #color #applications #windows

tui-tools

A collection of tools for building terminal user interfaces

3 releases

0.1.2 Aug 12, 2023
0.1.1 Aug 8, 2023
0.1.0 Aug 8, 2023

#682 in Command-line interface

Download history 21/week @ 2024-02-19 21/week @ 2024-02-26 8/week @ 2024-03-04 7/week @ 2024-03-11 4/week @ 2024-03-25 48/week @ 2024-04-01

61 downloads per month
Used in hex_it

MIT license

7KB
102 lines

tui-tools

Description

Some tools I use for colorizing, and accepting input in a tui applications with minimal dependencies.

Usage

Add the following to your Cargo.toml

[dependencies]
tui-tools = "0.1.0"

Examples

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();
}

License

MIT

Sources

Dependencies

~0–11MB
~58K SLoC