10 releases

0.5.0 Nov 30, 2018
0.4.0 Feb 21, 2018
0.3.4 Sep 17, 2017
0.3.3 Aug 11, 2017
0.1.1 Jun 2, 2017

#23 in Command-line interface

Download history 11325/week @ 2019-12-02 12246/week @ 2019-12-09 13290/week @ 2019-12-16 8740/week @ 2019-12-23 9825/week @ 2019-12-30 14225/week @ 2020-01-06 14439/week @ 2020-01-13 13349/week @ 2020-01-20 15095/week @ 2020-01-27 15518/week @ 2020-02-03 14205/week @ 2020-02-10 14188/week @ 2020-02-17 16685/week @ 2020-02-24 14678/week @ 2020-03-02 15843/week @ 2020-03-09 15763/week @ 2020-03-16

46,748 downloads per month
Used in 195 crates (46 directly)

MIT/Apache

55KB
671 lines

yansi

Build Status Current Crates.io Version Documentation

A dead simple ANSI terminal color painting library for Rust.

use yansi::Paint;

print!("{} light, {} light!", Paint::green("Green"), Paint::red("red").underline());

See the documentation for more.

Why?

Several terminal coloring libraries exist (ansi_term, colored, term_painter, to name a few), begging the question: why yet another? Here are a few reasons:

  • This library is much simpler: there are three types!
  • Unlike ansi_term or colored, any type implementing Display or Debug can be stylized, not only strings.
  • Styling can be enabled and disabled globally, on the fly.
  • Arbitrary items can be masked for selective disabling.
  • Styling can wrap any arbitrarily styled item.
  • Typically only one type needs to be imported: Paint.
  • Zero dependencies. It really is simple.
  • The name yansi is pretty short.

All that being said, this library borrows API ideas from the three libraries as well as implementation details from ansi_term.

License

yansi is licensed under either of the following, at your option:

No runtime deps