3 unstable releases

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

#858 in Command-line interface

33 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

~155KB