#terminal-colors #color #style #terminal #cli #chalk

chalk_rs

A crate which adds colors and styles to your terminal program

1 stable release

1.0.1 May 20, 2020
1.0.0 May 6, 2020

#558 in Command-line interface

Download history 39/week @ 2024-07-22 9/week @ 2024-07-29 7/week @ 2024-08-05 5/week @ 2024-08-12 57/week @ 2024-08-19 25/week @ 2024-08-26 30/week @ 2024-09-02 7/week @ 2024-09-09 8/week @ 2024-09-16 20/week @ 2024-09-23 9/week @ 2024-09-30 8/week @ 2024-10-07 51/week @ 2024-10-14 6/week @ 2024-10-21 7/week @ 2024-10-28 34/week @ 2024-11-04

99 downloads per month
Used in 8 crates (3 directly)

Custom license

21KB
579 lines

A crate for terminal colors and styles

use chalk_rs::prelude::*;
fn main() {
    let mut chalk = BasicChalk::new();
    chalk.red().println(&"This text is red");
    chalk.bold().println(&"Now it's red AND bold");
}

That's an example of basic color. There are three types of color in chalk: Basic, Ansi, and RGB.

use chalk_rs::prelude::*;

fn main() {
    let mut ansi = AnsiChalk::new();
    ansi.ansi(56).println(&"Purple-ish");
    let mut rgb = RgbChalk::new();
    rgb.rgb(25, 125, 63).println(&"This color is ugly");
}

RGB chalk is able to use ANSI and Basic color. ANSI chalk is able to use basic colors. However, ANSI chalk cannot use RGB and Basic chalk can't use RGB or ANSI.

use chalk_rs::prelude::*;

fn main() {
    let mut rgb = RgbChalk::new();
    rgb.ansi(56).println(&"Purple-ish");
    rgb.red().println(&"red");
}

lib.rs:

A crate for terminal colors and styles

use chalk_rs::Chalk;

let mut chalk = Chalk::new();
chalk.red().println(&"This text is red");
chalk.bold().println(&"Now it's red AND bold");

That's an example of basic color. There are three types of color in chalk: BasicChalk, AnsiChalk, and RgbChalk.

use chalk_rs::Chalk;


let mut chalk = Chalk::new();
chalk.ansi(56).println(&"Purple-ish");
chalk.rgb(25, 125, 63).println(&"This color is ugly");

Chalk can aldo do styling! Here's an example:

use chalk_rs::Chalk;

let mut chalk = Chalk::new();
chalk.bold().println(&"Bold!");

Dependencies

~175KB