#color #text #weight #coloring #weigh #color-string #input-color

ColorShell

A small crate for coloring text for rust

14 stable releases

1.1.5 May 21, 2024
1.1.4 May 18, 2024
1.1.2 May 17, 2024
1.1.1 May 16, 2024
1.0.9 May 16, 2024

#1 in #coloring

Download history 332/week @ 2024-05-11 386/week @ 2024-05-18 14/week @ 2024-05-25

538 downloads per month

MIT/Apache

6KB
75 lines

ColorShell

Colorshell is a rust library i made while i was bored. I have only been doing rust for 2.5 days. It lets you easily print colored text to the console

Features

The color Function

The color function will color text you give it. The color paramater takes in a color struct

Definition:

fn color(text: &'static str, clr: Color) -> String {

}

The input_color function

Get console input with this function choose what color the input will be

Definition:

fn color(iptext: &'static str, clr: Color) -> String {
    
}

The weigh function

Add Weight to text you give it Definition:

fn weigh(text: &'static str, wht: Weight) -> String {

}

Example:

use ColorShell::*;

fn main(){
    println!("{}", weigh("Hello World", Weight::BOLD));
}

The Color Struct

There are a few default colors:

  • BLACK
  • RED
  • ORANGE
  • YELLOW
  • LIGHTGREEN
  • DARKGREEN
  • MINT
  • CYAN
  • LIGHTBLUE
  • SKYBLUE
  • BLUE
  • DARKBLUE
  • DEEPPURPLE
  • PURPLE
  • VIOLET
  • MAGENTA
  • WARMPINK
  • WATERMELON
  • LIGHTGRAY
  • DARKGRAY

Any others can be created with:

Color {
    r: <red>,
    g: <green>,
    b: <blue>
}

The Weight Struct

There are a few default weights:

  • BOLD
  • DIM
  • ITALIC
  • UNDERLINED
  • SLOWBLINK
  • FASTBLINK

No runtime deps