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

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

#113 in Command-line interface

Download history 4169/week @ 2024-08-05 5346/week @ 2024-08-12 6510/week @ 2024-08-19 5657/week @ 2024-08-26 5393/week @ 2024-09-02 6265/week @ 2024-09-09 5250/week @ 2024-09-16 5958/week @ 2024-09-23 7940/week @ 2024-09-30 7144/week @ 2024-10-07 6051/week @ 2024-10-14 6902/week @ 2024-10-21 6066/week @ 2024-10-28 6469/week @ 2024-11-04 6743/week @ 2024-11-11 7423/week @ 2024-11-18

26,964 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