Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!

Comments

There are a few crates yansi, termcolor, colored, and ansi_term in Rust which can help print colorful text in terminal. Yansi is recommended as it is dead simple and the project is active.

Hands on yansi

:dep yansi = "0.5.1"
use yansi::Paint;
println!("{} light, {} light!", Paint::green("Green"), Paint::red("red").underline());
Green light, red light!