Simple Ansi Colors (strives for ~=0 cost) ```rust use scolor::ColorExt; println!("{}", "hello".red().bold().underline()); println!("{}", "world".green().red_bg().italic());
use scolor::{Color, CustomStyle, ColorDesc, Effect}; const LIGHTBLUEITALICBOLD: CustomStyle<2, 2> = ([ColorDesc::lightblue(), ColorDesc::red_bg()], [Effect::Italic, Effect::Bold]);
println!("{}", "world".custom(LIGHTBLUEITALIC_BOLD)); ```
Const equivalent of trait functions are provided as freestanding top-level functions
rust
const BLUE_WORLD: scolor::ColorFmt<'_,str,1,0> = scolor::blue("world");
For even more zero cost power you can enable zero-cost
feature
It makes the generated ASCII code as optimal as it can be
But the cost is that it's less ergonomic, the API is invoked like this: ```rust use scolor::ColorExt; println!("{}", "hello".green().bold::<1>().red_bg::<2>().italic::<2>());
use scolor::{ColorDesc, ColorFmt, Effect, green}; const :() = { let fmt = green("hello").italic::<1>().bold::<2>().redbg::<2>().crossedout::<3>(); assert!(matches!(ColorFmt{fmt:"hello",color:[ColorDesc::green(),ColorDesc::redbg()],effect:[Effect::Italic, Effect::Bold]}, fmt)); }; ```
License: MIT