colored-rs / colored

(Rust) Coloring terminal so simple you already know how to do it !
Mozilla Public License 2.0
1.68k stars 82 forks source link

Implement custom colors that can be stored in a variable (Solves #102) #112

Closed mrquantumoff closed 2 years ago

mrquantumoff commented 2 years ago

Now you can create a color using something like this

use colored::*;
let mycolor = CustomColor::new(0,255,0);
println!("{}","Hi mom, I made my open source contribution today!".custom_color(&mycolor));
println!("{}","Hi there!".on_custom_color(&mycolor));

To Implement this I added a new struct called CustomColor, and a module called customcolors with a bit of implementation in it and then modified src/lib.rs file to add custom_color in it.

Bwahharharrr commented 1 year ago

This doesn't work for me, Error: cannot find 'CustomColor' in this scope. Using colored = "2" in Cargo.toml and having imported with use colored::*;

mrquantumoff commented 1 year ago

Because there is no stable release with this feature

kurtlawrence commented 1 year ago

You can reference this repository to get the latest code:

colored = { git = "https://github.com/mackwic/colored" }