Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/zacharygolba/skittles

🌈 Add colors and formatting to ANSI terminal output with easy-to-use macros.
https://github.com/zacharygolba/skittles

ansi color console macro rust terminal

Last synced: about 2 months ago
JSON representation

🌈 Add colors and formatting to ANSI terminal output with easy-to-use macros.

Awesome Lists containing this project

README

        

# skittles

[![CircleCI branch](https://img.shields.io/circleci/project/github/zacharygolba/skittles/master.svg?style=flat-square)](https://circleci.com/gh/zacharygolba/skittles/tree/master) [![AppVeyor branch](https://img.shields.io/appveyor/ci/zacharygolba/skittles/master.svg?logo=appveyor&style=flat-square)](https://ci.appveyor.com/project/zacharygolba/skittles/branch/master) [![Crates.io](https://img.shields.io/crates/v/skittles.svg?style=flat-square)](https://crates.io/crates/skittles)

Add colors and formatting to ANSI terminal output with easy-to-use macros built on top of [`ansi_term`](https://docs.rs/ansi_term).

## Installation

First, add `skittles` to the dependencies section of your `Cargo.toml`:

```toml
[dependencies]
skittles = "0.1"

```

Next, add add this to the entrypoint of your crate (`lib.rs` or `main.rs`).

```rust
#[macro_use]
extern crate skittles;
```

## Usage

Each macro provided by `skittles` can accept a string literal or a format string with arguments as input.

```rust
println!(
"{} - {} {} {}.",
underline!("Skittles"),
red!("Taste"),
green!("the"),
blue!("rainbow")
);
```

You can also compose `skittles` macros together to get the exact color and formatting you want while avoiding itermediate allocations entirely.

```rust
println!(
"{} - {} {} {}.",
blink!(yellow!("Skittles")),
underline!(red!("Taste")),
underline!(italic!(green!("the"))),
underline!(bold!(blue!("rainbow")))
);
```

## License

Licensed under either of

* Apache License, Version 2.0
([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
* MIT license
([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)

at your option.

## Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted
for inclusion in the work by you, as defined in the Apache-2.0 license, shall be
dual licensed as above, without any additional terms or conditions.