All Projects → SergioBenitez → yansi

SergioBenitez / yansi

Licence: other
A dead simple ANSI terminal color painting library for Rust.

Programming Languages

rust
11053 projects

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:

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].