コンソールの色付け用のマクロ crate 書いた for Rust

色付けるのは、たくさん見つかるんだけどイマイチすっきり書けないのが多かったので書いちゃった。

deco - Cargo: packages for Rust

fn main() {
  dprintln!([red bold "RED and BOLD TEXT" !]);
  dprintln!([red bold "RED and BOLD TEXT with argument `0x{:x}`" !] 0xbeef);

  dprintln!([red bold "RED and BOLD" reset " ... NORMAL"]);

  dprintln!([yellow on_red "yellow on red" !]);

  let mut out = "".to_owned();
  dwriteln!(out, [italic "ITALIC TEXT" !]).unwrap();
  println!("out is {}", out);
}