Termal
Rust library for terminal features.
RAW terminal support
- Unix (linux)
- Windows (not tested)
Example
With macro
use *;
// you can use a special macro to inline the color codes, this will write
// italic text with yellow foreground and reset at the end.
printcln!;
// the macro also supports standard formatting
printcln!;
// you can also use short versions of the codes
printcln!;
// you can also use true colors with their hex codes
printcln!;
Without macro
// Move cursor to position column 5 on line 7 and write 'hello' in italic
// yellow
use *;
println!;
The macros such as move_to!
can accept either literals or dynamic values.
Its main feature is that if you supply literals, it expands to a string
literal with the ansi code.
If you however supply dynamic values it expands to a format!
macro:
use *;
let a = move_to!;
// expands to:
let a = "\x1b[5;7H";
let b = move_to!;
// expands to:
let b = format!;
If you know the values for the arguments you can also use the *c
macros:
use formatc;
// the spaces, or the lack of them is important
let a = formatc!;
Gradients
Youn can create gradients with the function termal::gradient
:
use *;
// This will create foreground gradient from the rgb color `(250, 50, 170)`
// to the rgb color `(180, 50, 240)`
printcln!;
How to use it
To see all the possible commands and uses see docs.
How to get it
It is available on crates.io:
With cargo
cargo add termal
In Cargo.toml
[]
= "1.0.0"
Features
raw
: enable features for raw terminal.
term_image
: enables functionality for drawing images to terminal.image
: enablesterm_image
and dependency forimage
with impl forImage
trait.term_text
: enable features for basic parsing of ansi escape codes.all
: enable all features.
Links
- Author: BonnyAD9
- GitHub repository: BonnyAD/raplay
- Package: crates.io
- Documentation: docs.rs
- My Website: bonnyad9.github.io