colorize-rs 0.1.2

Simple terminal text colorisation using ansi characters
Documentation
  • Coverage
  • 51.61%
    48 out of 93 items documented0 out of 50 items with examples
  • Size
  • Source code size: 22.71 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 2.87 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 10s Average build duration of successful builds.
  • all releases: 9s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • MOBSkuchen/colorize-rs
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • MOBSkuchen

colorize-rs

A fork of colorize https://github.com/jeremyletang/colorize

cargo add colorize-rs

colorize-rs provide simple text colorization for terminal emulator, using ansi escape characters.

Look at this example:

extern crate colorize_rs;
use colorize_rs::{AnsiColor, Color};

pub fn main() {
    // Set some global colors
    colorize_rs::global_fg(Color::Blue);
    colorize_rs::global_bg(Color::Red);
    // ^~~~ These settings are reset to default at the end.

    // You can use specific colors or style on a given str,
    // the globals colors are restored after !

    // Write a green underlined text on a yellow background !
    println!("{}", "Hello World !".green().underlined().yellowb());

    // Use bright or normal colors
    println!("{}", "Bright Green foreground and Magenta background !".b_green().magentab());
}