colorism 0.1.0

A library to use terminal ANSI colors
Documentation
  • Coverage
  • 0%
    0 out of 45 items documented0 out of 6 items with examples
  • Size
  • Source code size: 6.54 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.75 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 9s Average build duration of successful builds.
  • all releases: 9s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • imf4ll/colorism
    1 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • imf4ll

 

❗️ Install:

cargo add colorism

 

🚀 Usage:

Using the foreground method:

// Import the fore method and RESET
use colorism::{foreground::Fore, util::RESET};

// Use RESET on all string ends, if you don't, the colors will escape to your terminal and will be really ugly, but not danger.
fn main() {
    // Green regular text
    println!("{}Hello, world!{}", Fore::color(Fore::Green), RESET);

    // Green bold text
    println!("{}Hello, world!{}", Fore::color(Fore::BdGreen), RESET);
}

 

Using the background method:

use colorism::{background::Back, util::RESET};

// Use RESET on all string ends, if you don't, the colors will escape to your terminal and will be really ugly, but not danger.
fn main() {
    // Green background, white text
    println!("{}Hello, world!{}", Back::color(Back::Green), RESET);

    // Green background, white bold text
    println!("{}Hello, world!{}", Back::color(Fore::BdGreen), RESET);
}

 

Using the utils:

// Import the util and (We will use Style to styling texts) RESET
use colorism::util::{Style, RESET};

// Use RESET on all string ends, if you don't, the colors will escape to your terminal and will be really ugly, but not danger.
fn main() {
    // Simple bold text
    println!("{}I am a text{}", Style::text(Style::Bold), RESET);

    // Simple underline text
    println!("{}I am a text{}", Style::text(Style::Underline), RESET);
}