coloured-strings

Crates.iocoloured-strings
lib.rscoloured-strings
version0.1.10
sourcesrc
created_at2023-01-20 21:54:47.699551
updated_at2023-03-19 03:41:43.000429
descriptionCrate that makes colouring strings easy and lightweight (< 3.0 kb)!
homepagehttps://github.com/Rar3Pineapple/Coloured-Strings
repositoryhttps://github.com/Rar3Pineapple/Coloured-Strings
max_upload_size
id763769
size9,459
Pineapple (Rar3Pineapple)

documentation

https://docs.rs/coloured-strings/0.1.0/coloured_strings/

README

coloured-strings

banner Rust crate that allows coloured strings to be printed to the terminal with the smallest file size neccessary.

NOTE: This version supports true colour in exchange for a slightly larger file size. If rgb colour is not neccessary, please download the previous verion instead.

  colour("this is a green string", "green");
  colour("this is a red string", "r");
  colour("this is a string with a strikethrough", "s");
  colour(&colour("this string has white text and a blue background", w")[..], "b-bl"));
  custom_colour("A custom string!", true, 255, 100, 200);

How to Use

Run cargo add coloured-strings Afterwards, write this in your file use coloured_strings

Example:

use coloured_strings::*;

fn main() {
    println!("{}", colour("I love coloured text!", "brightgreen");
}

Current Colours

   // normal colours
    "black" | "b"
    "red" | "r"
    "green" | "g"
    "yellow" | "y"
    "blue" | "bl"
    "magenta" | "m"
    "cyan" | "c"
    "white"| "w"

    // bright colours
    "brightblack" | "bb"
    "brightred" | "br"
    "brightgreen" | "bg"
    "brightyellow" | "by"
    "brightblue" | "bbl"
    "brightmagenta" | "bm"
    "brightcyan" | "bc"
    "brightwhite" | "bw"

    //background colours
    "backgroundred" | "b-r"
    "backgroundgreen" | "b-g"
    "backgroundyellow" | "b-y"
    "backgroundblue" | "b-b"
    "backgroundmagenta" | "b-m"
    "backgroundcyan" | "b-c"
    "bacgroundwhite" | "b-w"

    //bright background colours
    "backgroundbrightblack" | "b-bb"
    "backgroundbrightred" | "b-br"
    "backgroundbrightgreen" | "b-bg"
    "backgroundbrightyellow" | "b-by"
    "backgroundbrightblue" | "b-bbl"
    "backgroundbrightmagenta" | "b-bm"
    "backgroundbrightcyan" | "b-bc"
    "backgroundbrightwhite" | "b-bw"

   // other styles
    "clear" | "cl"
    "dimmed" | "d"
    "italic" | "i"  
    "underline" | "u"
    "blink" | "bli"  
    "reversed" | "re"
    "hidden" | "h"
    "strikethrough" | "s"

Commit count: 35

cargo fmt