Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow colorizing any type implementing a formatter trait #139

Open
hwittenborn opened this issue Jul 3, 2023 · 3 comments
Open

Allow colorizing any type implementing a formatter trait #139

hwittenborn opened this issue Jul 3, 2023 · 3 comments
Labels
breaking Will need a major version bump

Comments

@hwittenborn
Copy link
Member

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.

@hwittenborn
Copy link
Member Author

hwittenborn commented Jul 3, 2023

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.

@kurtlawrence
Copy link
Collaborator

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?

@kurtlawrence kurtlawrence added the breaking Will need a major version bump label Jul 3, 2023
@hwittenborn
Copy link
Member Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking Will need a major version bump
Projects
None yet
Development

No branches or pull requests

2 participants