#ansi #console #vt100

dev output_vt100

Utility to activate escape codes in Windows' CMD and PowerShell

4 releases

0.1.3 Feb 12, 2022
0.1.2 Feb 21, 2019
0.1.1 Feb 14, 2019
0.1.0 Feb 14, 2019

#109 in Command-line interface

Download history 53543/week @ 2023-11-21 46485/week @ 2023-11-28 50922/week @ 2023-12-05 42258/week @ 2023-12-12 32605/week @ 2023-12-19 18099/week @ 2023-12-26 45100/week @ 2024-01-02 40041/week @ 2024-01-09 40765/week @ 2024-01-16 38280/week @ 2024-01-23 33863/week @ 2024-01-30 32226/week @ 2024-02-06 32440/week @ 2024-02-13 33120/week @ 2024-02-20 37030/week @ 2024-02-27 26508/week @ 2024-03-05

134,237 downloads per month
Used in 474 crates (5 directly)

MIT license

6KB
50 lines

crates.io Released API docs Downloads MIT Licensed AppVeyor CI Build Status

Output-VT100

This simple crates allows developers to enable ANSI escape characters in Windows' console, be it CMD or PowerShell. Its usage is very simple, as shown below:

extern crate output_vt100;

fn main() {
    output_vt100::init();
    println!("\x1b[31mThis text is red!\x1b[0m");
}

If you wish to ensure the output_vt100::init() function is only ran once, you can use the crate ctor. Be aware though it might not be suited for every use case, as explained on the crate’s presentation.

extern crate output_vt100;
extern crate ctor;
use ctor::*;

#[ctor]
fn init_term() {
    output_vt100::init();
}

fn main() {
    println!("\x1b[31mThis text is red!\x1b[0m");
}

Not that init panics on error, if you do not wish to panic, use output_vt100::try_init which returns a Result<(), ()>

Acknowledgements

A big thank you to nbouteme who helped me a lot during the development of this create.

Dependencies

~225KB