Crate coloriz[][src]

Expand description

A library for Rust that provides utilities to colorizing terminal outputs and styling strings.

Coloriz helps to make your terminal colorful.

Quick Example

use coloriz::*;

fn main() {
    let text = "Lorem ipsum";
    println!("{}", text.fg(Color::Cyan));
    println!("{}", text.bg(Color::BrightBlack).fg(Color::Red));
    println!("{}", text.fg(HSL::new(0.03, 0.7, 0.666)));
    println!("{}", text.fg((167, 232, 78))); // the same as text.fg(RGB::new(167, 232, 78))
    println!("{}", text.fg_gradient(RGB::from_hex(0xFF6712), RGB::from_hex(0x1087FF)));
    println!("{}", Color::BrightMagenta.to(text));
    println!("{}", Color::BrightMagenta.under(text));
}

Structs

Gradient

Linear color gradient between two color stops

HSL

HSL color

RGB

RGB color

StyledText

A string that may be colorized

Enums

Color

Represents terminal colors such as 8 standard colors, 256 colors and True colors

ColorStyle

Represents the style of coloring

StyleMode

Represents styles

Traits

ColorApply

A Color that can apply to text

Colorize

The trait that can be colored

Styling

The trait that can be styled