# ansi-str [](https://github.com/zhiburt/ansi-str/actions) [](https://codecov.io/gh/zhiburt/ansi-str) [](https://crates.io/crates/ansi-str) [](https://docs.rs/ansi-str/*/ansi_str/)
This is a library for work with coloured and formatted strings on ANSI terminals.
Its a library agnostic library.
Therefore it can be used with any ansi color library. (e.g. [owo-colors](https://crates.io/crates/owo-colors), [nu-ansi-term](https://crates.io/crates/nu-ansi-term)).
## Usage
```rust
use ansi_str::AnsiStr;
use owo_colors::{colors::*, OwoColorize};
pub fn main() {
let colored_text = "When the night has come"
.fg::<Red>()
.bg::<Cyan>()
.bold()
.to_string();
let s = colored_text.ansi_get(5..).unwrap();
println!("{}", colored_text);
println!("{}", s);
}
```
Running this code will result in the following output.

##### [For more examples, you check the directory of the same name.](https://github.com/zhiburt/ansi-str/tree/master/examples).
##### You can find a list of methods which are provided by the library on [the documentation page](https://docs.rs/ansi-str/*/ansi_str/).
### Note
The library has derivatived from [zhiburt/ansi-cut](https://github.com/zhiburt/ansi-cut)