Skip to content

zhiburt/ansi-str

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

63 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ansi-str Build Status codecov Crate docs.rs

This is a library provides a set of methods to work with strings escaped with ansi code sequences.

It's an agnostic library in regard to different color libraries. Therefore it can be used with any library.

Usage

use ansi_str::AnsiStr;

pub fn main() {
    let text = "\u{1b}[1m\u{1b}[31;46mWhen the night has come\u{1b}[0m\u{1b}[0m";

    let cut = text.ansi_get(5..).expect("ok");

    println!("{}", text);
    println!("{}", cut);
}

Running this code will result in the following output.

image

Note

The library has derivatived from zhiburt/ansi-cut

About

This is a library for work with colored and formatted strings on ANSI terminals.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published