Allow colorizing any type implementing a formatter trait
hwittenborn opened this issue · comments
Rust has several formatter traits, all of could be printed out (and likewise colored).
Currently this crate only provides a way to print via the Display
trait - any formatting traits would have to be done via a method such as format!("{item:?}").blue()
, which can get a bit clunky.
The proposed method to fix this is to allow any type to be formatted, as long as it implements the corresponding formatting type. I.e. if a type implements Debug
, doing something like println!("{:?}", item.blue())
should work just fine.
owo-colors
uses this method, and it's of my view that it's quite a good method of doing things. I think this crate should consider doing a similar approach for a v3, along with some other changes that people are requesting in this repository.
Oh by the way, what are your thoughts on having a v3 @mackwic @kurtlawrence? I'd definitely like to get your guys' opinions before doing anything huge.
I was also thinking of moving the current codebase to a v2
branch and starting v3 work on master
, which could allow some breaking PRs to start getting merged in. v3 wouldn't be published for a hot minute, it would just be in the codebase so people have a good place to start working on.
I think there are enough new features to justify a v3
.
Maybe we mark PRs 'breaking' and then try to merge in all non-breaking PRs and do a final v2
cratesio release?
Yeah I like that idea @kurtlawrence, I think that'd be good to keep things smooth. I can look at some PRs tomorrow and try to slim them down, and then all the v3
stuff can get started.