3 unstable releases

new 0.2.0 Dec 19, 2024
0.1.1 Dec 5, 2024
0.1.0 Oct 29, 2024

#851 in Command-line interface

Download history 114/week @ 2024-10-28 5/week @ 2024-11-04 3/week @ 2024-11-18 119/week @ 2024-12-02 16/week @ 2024-12-09

138 downloads per month

MIT/Apache

9KB
120 lines

A minimal package for using the Ansi Color :

Provides optional support for Serde (serialization / deserialization) when the "serde" feature is enabled.

use minimal_ansi_color::*;

println!("{}I'm green{}", AnsiColor::GREEN, AnsiColor::RESET);
println!("{}I'm red{}", AnsiColor::new_foreground(AnsiColorKind::Red), AnsiColor::RESET);
println!("{}White on magenta background{}", AnsiColor::new(AnsiColorKind::Magenta, AnsiColorLayer::Background), AnsiColor::RESET);

image

pub enum AnsiColorKind
{
    Black,
    Red,
    Green,
    Yellow,
    Blue,
    Magenta,
    Cyan,
    White,
    Grey,
}

pub enum AnsiColorLayer 
{
    Foreground,
    Background,
}

pub struct AnsiColor
{
    pub color : AnsiColorKind,
    pub layer : AnsiColorLayer,
}

lib.rs:

A minimal package for printing some Ansi Color

Provides optional support for Serde (serialization / deserialization) when the "serde" feature is enabled.

use minimal_ansi_color::*;

println!("{}I'm green{}", AnsiColor::GREEN, AnsiColor::RESET);
println!("{}I'm red{}", AnsiColor::new_foreground(AnsiColorKind::Red), AnsiColor::RESET);
println!("{}White on magenta background{}", AnsiColor::new(AnsiColorKind::Magenta, AnsiColorLayer::Background), AnsiColor::RESET);

Dependencies

~160KB