Crates.io | console-codes |
lib.rs | console-codes |
version | 0.1.2 |
source | src |
created_at | 2021-03-08 14:10:15.136527 |
updated_at | 2021-03-08 16:40:23.261173 |
description | Enums for rendering console codes |
homepage | https://github.com/j0057/console-codes-rs |
repository | https://github.com/j0057/console-codes-rs |
max_upload_size | |
id | 365699 |
size | 17,453 |
Some enums for rendering escape sequences as documented in console_codes(4). The main enum CSI implements Display so that it can easily be converted to a String.
Use the Erase Display
code to clear the screen, the CUrsor Position
code to
move the cursor to the top left corner, then a Set Graphics Rendition
sequence with three attributes to set the colors to blinking blue text on deep
sky blue background and print Hello, world!:
use console_codes::{CSI, SGR};
fn main() {
print!("{}", CSI::ED(2));
print!("{}", CSI::CUP(1, 1));
print!("{}", CSI::SGR(&[SGR::Blink, SGR::FG24(0, 0, 255), SGR::BG24(0, 191, 255)]));
print!("{}", "Hello, world!");
print!("{}", CSI::SGR(&[SGR::Reset]));
println!();
}