10000 GitHub - Hellaeh/hel-colored: ANSI string colorizer and styler
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Hellaeh/hel-colored

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hel-colored

ANSI string colorizer and styler

Features

  • Lazy (no-alloc, no-copy, until needed, e.g. to_string called)
  • Made with performance in mind
  • Only RGB(TrueColor) support (no default CLI colors)
  • No nested checks by default, which leads up to 2x performance.

Examples

Simply by

"Hello World!".bold().blue().underline();

Nested with "nested" feature

cargo add hel-colored -F nested
let blue_text: ANSIString<&str> = "blue text".blue();
let green_blue_green_text: ANSIString<String> = format!("Green {blue_text} wrapping").green();
// Better to call `to_string` above
println!("{green_blue_green_text}");

Or with builder

let builder: ANSIStringBuilder = ANSIStringBuilder::new().bold().underline().orange();
let str1 = builder.build("Hello");
let str2 = builder.build("World!");
println!("{str1}, {str2}")

How to install

cargo add hel-colored

About

ANSI string colorizer and styler

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

0