1 unstable release
0.1.0 | Oct 29, 2024 |
---|
#63 in #ansi-colors
119 downloads per month
7KB
106 lines
A minimal package for printing some Ansi Color
use minimal_ansi_color::*;
println!("{}I'm green{}", AnsiColor::GREEN_FOREGROUND, 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
use minimal_ansi_color::*;
println!("{}I'm green{}", AnsiColor::GREEN_FOREGROUND, 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);