#ansi #ansi-codes #terminal #codes #tty #vt100

no-std ansi-escapes

Ansi escape codes for manipulating the terminal

3 unstable releases

0.2.0 Jun 23, 2024
0.1.1 Aug 6, 2021
0.1.0 Nov 1, 2016

#109 in Command-line interface

Download history 4391/week @ 2024-07-18 5083/week @ 2024-07-25 4586/week @ 2024-08-01 4289/week @ 2024-08-08 5937/week @ 2024-08-15 6030/week @ 2024-08-22 5310/week @ 2024-08-29 6052/week @ 2024-09-05 5715/week @ 2024-09-12 5511/week @ 2024-09-19 7673/week @ 2024-09-26 6931/week @ 2024-10-03 6624/week @ 2024-10-10 7043/week @ 2024-10-17 6248/week @ 2024-10-24 5136/week @ 2024-10-31

26,532 downloads per month
Used in 21 crates (12 directly)

MIT license

10KB
141 lines

ANSI Escapes

ANSI escape codes for manipulating the terminal

Usage

This example program will print "Hello, World!", then replace it with "Hello, Terminal!" after one second.

extern crate ansi_escapes;

use std::thread::sleep;
use std::time::Duration;

fn main() {
    // Hides the cursor
    print!("{}", ansi_escapes::CursorHide);

    // Prints first message
    println!("Hello, World!");

    // Waits one seconds
    sleep(Duration::from_secs(1));

    // Erases the two lines
    print!("{}", ansi_escapes::EraseLines(2));

    // Print final message
    println!("Hello, Terminal!");

    // Shows the cursor
    print!("{}", ansi_escapes::CursorShow);
}

API

See documentation

No runtime deps