Crate ansi_cut

Crate ansi_cut 

Source
Expand description

§Ansi-cut

A library for cutting a string while preserving colors.

§Example

use ansi_cut::AnsiCut;
use owo_colors::{colors::*, OwoColorize};

let colored_text = "When the night has come"
    .fg::<Black>()
    .bg::<White>()
    .to_string();

let cutted_text = colored_text.cut(5..);

println!("{}", cutted_text);

Traits§

AnsiCut
AnsiCut a trait to cut a string while keeping information about its color defined as ANSI control sequences.

Functions§

chunks
Returns an Vec over chunk_size elements of string, starting at the beginning of the slice. It uses chars but not bytes!