anscape

Crates.ioanscape
lib.rsanscape
version0.2.2
sourcesrc
created_at2022-08-15 16:45:24.225
updated_at2022-08-18 18:52:25.797333
descriptionAnscape provides a simple way to customize your terminal window with some styles and colors and manipulate with a cursor position using ANSI Escape Sequences.
homepage
repositoryhttps://github.com/arg2u/anscape
max_upload_size
id646027
size14,314
Airat Galiullin (arg2u)

documentation

https://docs.rs/anscape

README

Latest Version | Documentation

Anscape provides a simple way to customize your terminal window with some styles and colors and manipulate with a cursor position using ANSI Escape Sequences.

Features

  • 256-color mode.
  • Cursor movement.
  • Text formatting.
  • Console size.
  • Erasing.

Examples

Style and colors

use anscape::{
    seq::colors::*,
    seq::styles::*, 
    seq::base::*, 
};

fn main() {
    // Basic foregroung
    println!("{}{}Red bold text, {}{} Green Italic{}", RED, BOLD, GREEN, ITALIC, RESET);

    // Basic background
    println!("{}{}Red BG for bold text, {}{} Green BG for italic text{}", RED_BG, BOLD, GREEN_BG, ITALIC, RESET);

    // RGB foreground
    println!("{}Here's red RGB color{}", rgb_fg(255, 0, 0), RESET);

    // RGB background
    println!("{}Here's red RGB BG color{}", rgb_bg(255, 0, 0), RESET);
}

Moving the cursor

use anscape::seq::cursor;

fn main() {
    println!("{}Move to line 1 col 1", cursor::move_to(100, 100));
}

Erase

use anscape::seq::erase::*;

fn main() {
    println!("{}Erase", FROM_CURSOR_TO_BEGINING_OF_SCREEN);
}

License

MIT

Commit count: 6

cargo fmt