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
138 downloads per month
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);
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