Crate termcol

Source
Expand description

§termcol

Dependency-less library for simple terminal text coloring and formating

§Usage

Basic usage (checkout the examples/usage.rs file for more information)

use termcol::*;

fn main() {
    println!("{}red{}", color("red"), color("reset"));
    println!("{}bold{}", format("bold"), format("reset"));
    println!("{}", color_string("im blue", "blue"));
}

§LICENSE

This project is distributed under MIT license.

Functions§

clean_output
Function providing a way to disable any form of coloring/formating
color
Function providing a way to color your cli output
color_string
Function providing a way to color your cli output
format
Function providing a way to format you cli output
format_string
Function providing a way to format you cli output
get_disable_coloring_state
Helper function returning the value of DISALBE_COLORING global variable
optimize
Function which optimizes given string from unneded reset control codes
true_color
Returns true color escape codes for given u8 values background_or_foreground true => change background background_or_foreground false => change foreground
true_color_hex
Returns true color escape codes from given hex string background_or_foreground true => change background background_or_foreground false => change foreground
true_color_string
Returns given string altered with true color escape codes from given u8 values
true_color_string_hex
Returns given string altered with true color escape codes from given hex strings