Crates.io | colourful |
lib.rs | colourful |
version | 0.1.0 |
source | src |
created_at | 2023-08-30 12:15:40.959062 |
updated_at | 2023-08-30 12:15:40.959062 |
description | A lightweight, fast, and easy-to-use library for creating coloured strings with ANSI |
homepage | https://github.com/rookieCookies/colourful |
repository | https://github.com/rookieCookies/colourful |
max_upload_size | |
id | 958918 |
size | 11,457 |
A lightweight, fast, and easy-to-use library for creating coloured strings with ANSI
Ergonomics and speed should not be mutually exclusive, let's look at some examples
println!("'{}'", "bold red on navy blue".red().bold().bg_navy_blue());
println!("'{}'", "green background".bg_colour(Colour::rgb(0, 255, 0,)));
println!("'{}'", "red on green background".colour(Colour::rgb(255, 0, 0)).bg_colour(Colour::rgb(0, 255, 0,)));
println!("'{}'", "bold".bold());
println!("'{}'", "dim".dim());
println!("'{}'", "italic".italic());
println!("'{}'", "underline".underline());
println!("'{}'", "blinking".blinking());
println!("'{}'", "inverse".inverse());
println!("'{}'", "hidden".hidden());
println!("'{}''", "strikethrough".strikethrough());
println!("also works on any type with display {}", Vector3(0.5, 0.3, 1.2).red().blinking());
println!("or debug.. who am i to judge {:#?}", vec!["mhm", "sup", "okay"].strikethrough());
No other dependencies
Allocation free
Blazingly fast
Does not emit colours when piping to a file
Respects NO_COLOR
and FORCE_COLOR
Ability to colour and style any type that implements Display
or Debug
Add the dependency to your crate
Import colourful::ColourBrush
You're good to go!
The base crate relies on reading environment variables to abide by NO_COLOR
, and FORCE_COLOR
and not print colours when piping. The crate should be able to compile with no_std
without you needing to do anything, but these features won't be available