Skip to content

nate-sys/aecir

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

aecir

Ansi escape codes in Rust.

Usage

Add this your Cargo.toml

[dependencies]
aecir = {git='https://github.com/nate-sys/aecir', branch = 'main'}

Examples

You can run the examples from this repo.

git clone https://github.com/nate-sys/aecir
cd aecir
cargo run --example <example_name>

Philosophy

Most of these aliases are just Structs and Enums that impl std::fmt::Display or functions that return their corresponding string values. Almost all of these aliases expect you to do the writing to stdout and flushing.

use aecir::style::{self, Color, ColorName};
use std::io::{stdout, Write};

fn main() {
    let mut stdout = stdout(); 

    write!(
        stdout, 
        "{}Hello world{}", 
        Color::Fg(ColorName::Red), 
        style::reset_colors(),
    ).unwrap();

    stdout.flush().unwrap()
}

About

ANSI escape codes in Rust

Topics

Resources

License

Stars

Watchers

Forks

Languages