stylic 0.3.0

A simple, fast library for styling text with ANSI escape codes
Documentation
![Crates.io Version](https://img.shields.io/crates/v/stylic)
![Crates.io License](https://img.shields.io/crates/l/stylic)

<!-- cargo-rdme start -->

A simple, fast library for styling text with ANSI escape codes.

# Features

- Simple, intuitive API
- Fast, no allocations
- `#![no_std]` support
- No dependencies
- Supports hyperlinks
- Supports globally enabling and disabling styling

# Usage

Use the [`style`](fn@crate::style) function to create a [`Styled`](https://docs.rs/stylic/latest/stylic/struct.Styled.html) value which can be styled using methods from the [`Stylize`](https://docs.rs/stylic/latest/stylic/trait.Stylize.html) trait and can be displayed.

```rust
use stylic::{style, Stylize};

println!("{}", style("Hello, World!").green().italic());
```

The [`Stylize`](https://docs.rs/stylic/latest/stylic/trait.Stylize.html) trait provides methods for setting the foreground color, background color, underline color, and attributes of the text (such as bold, italic, etc).

Available attributes are:

- `bold`
- `dim`
- `italic`
- `underlined`
- `blink`
- `inverted`
- `hidden`
- `strikethrough`

Available colors include basic ANSI colors, the extended 256-color palette, and RGB colors.

The ANSI colors are:

- `black`
- `red`
- `green`
- `yellow`
- `blue`
- `magenta`
- `cyan`
- `white`

Plus bright variants.

There are methods on the `Style` struct for setting the foreground color, background color and underline color to basic ansi colors:

```rust
use stylic::{BasicColor, Color, Stylize, style};

println!("{}", style("Hello, World!").black().on_blue());
```

There are also `fg`, `bg` and `underline_colored` methods that take a `Color` or any other value implementing `Into<Color>`, allowing the use of colors from the extended 256-color palette and RGB colors:

```rust
use stylic::{BasicColor, Color, Stylize, style};

// Setting the foreground color to red.
println!("{}", style("Hello, World!").fg(Color::Basic(BasicColor::Red)));
println!("{}", style("Hello, World!").fg(BasicColor::Red));

// Setting the background color to a color from the 256-color palette.
println!("{}", style("Hello, World!").bg(Color::Extended(58)));
println!("{}", style("Hello, World!").bg(58));

// Setting the underline color to a RGB color.
println!("{}", style("Hello, World!").underline_colored(Color::Rgb(255, 0, 255)));
println!("{}", style("Hello, World!").underline_colored((255, 0, 255)));
```

Styles can also be created and stored for later use:

```rust
use stylic::{style, Style, Stylize};

let my_style = Style::new().bold().bright_blue();
println!("{}", style("Hello, World!").apply(my_style));
```

# Enabling and disabling styling

Use the [`set_style_enabled`](https://docs.rs/stylic/latest/stylic/enable/fn.set_style_enabled.html) function from the [`enable`](https://docs.rs/stylic/latest/stylic/enable/) module to globally enable or disable styling. See the module documentation for more information.

<!-- cargo-rdme end -->