]>
Commit | Line | Data |
---|---|---|
62c5094d FG |
1 | # yansi |
2 | ||
3 | [![Build Status](https://travis-ci.org/SergioBenitez/yansi.svg?branch=master)](https://travis-ci.org/SergioBenitez/yansi) | |
4 | [![Current Crates.io Version](https://img.shields.io/crates/v/yansi.svg)](https://crates.io/crates/yansi) | |
5 | [![Documentation](https://docs.rs/yansi/badge.svg)](https://docs.rs/yansi) | |
6 | ||
7 | A dead simple ANSI terminal color painting library for Rust. | |
8 | ||
9 | ```rust | |
10 | use yansi::Paint; | |
11 | ||
12 | print!("{} light, {} light!", Paint::green("Green"), Paint::red("red").underline()); | |
13 | ``` | |
14 | ||
15 | See the [documentation](https://docs.rs/yansi/) for more. | |
16 | ||
17 | # Why? | |
18 | ||
19 | Several terminal coloring libraries exist ([`ansi_term`], [`colored`], | |
20 | [`term_painter`], to name a few), begging the question: why yet another? Here | |
21 | are a few reasons: | |
22 | ||
23 | * This library is _much_ simpler: there are three types! | |
24 | * Unlike [`ansi_term`] or [`colored`], _any_ type implementing `Display` | |
25 | or `Debug` can be stylized, not only strings. | |
26 | * Styling can be enabled and disabled globally, on the fly. | |
27 | * Arbitrary items can be [_masked_] for selective disabling. | |
28 | * Styling can [_wrap_] any arbitrarily styled item. | |
29 | * Typically only one type needs to be imported: `Paint`. | |
30 | * Zero dependencies. It really is simple. | |
31 | * The name `yansi` is pretty short. | |
32 | ||
33 | All that being said, this library borrows API ideas from the three libraries as | |
34 | well as implementation details from [`ansi_term`]. | |
35 | ||
36 | [`ansi_term`]: https://crates.io/crates/ansi_term | |
37 | [`colored`]: https://crates.io/crates/colored | |
38 | [`term_painter`]: https://crates.io/crates/term-painter | |
39 | [_masked_]: https://docs.rs/yansi/#masking | |
40 | [_wrap_]: https://docs.rs/yansi/#wrapping | |
41 | ||
42 | ## License | |
43 | ||
44 | `yansi` is licensed under either of the following, at your option: | |
45 | ||
46 | * Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0) | |
47 | * MIT License ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT) |