-
Notifications
You must be signed in to change notification settings - Fork 76
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
Revisit recommended text colouring crate #100
Comments
I've also seen https://github.com/jam1garner/owo-colors recommended. Which bills itself as a drop-in replacement for colored, but with no_std support. Thoughts? |
imo most approaches to coloring are flawed because they require you to know what you are rendering to (stdout, stderr, a file, etc). I've created anstream as a wrapper around output sinks that auto-adapts the content to what you are writing to. In these scenarios, you always write colored output and don't worry about. burntsushi has expressed interest in this as a potential replacement for termcolor. The download count is high but that is biased by it being used in some high-download count packages. It has recently been adopted in cargo but that is also biased by the fact that I'm on the cargo team. If curious, rust-lang/cargo#12751 is where I converted cargo from termcolor to anstream. A color rendering library is still needed. Depending on what I need, I tend to use a mixture of |
colored could be the recommendation for std enviroments and owo-colors the recommendation for no_std enviromments and embedded systems? I haven't used owo-colors myself but from looking into it, colored still seems to make the most sense in enviroments that aren't embedded systems or no_std:
|
It looks like the main difference between An odd point about |
Author of I don't know what the criteria is for whether a crate is "blessed" or not, but I presume These days, support for legacy Windows consoles is getting less and less important. I myself am eager to drop it and just fall back to emitting ANSI escapes manually through some custom hand-rolled code inside of ripgrep. I do like @epage's approach personally, but the dependency tree of I don't know how to pick which of these choices is "blessed," but IMO the curator should express an opinion and choose one. I myself am eager to deprecate |
I'm not responding directly to @BurntSushi but to those who might get the wrong impression by this. Note that a valid alternative given is directly writing ANSI escape codes, ie not even having |
Note that |
Neither |
|
To help frame the discussion: the motivation behind setting up blessed.rs was the frequent complaints from members of the community (or would-be members of the community) that Rust's std library was too small, that the crates.io ecosystem was overwhelming, and that it was difficult both to discover the "de facto standard" crates and to know which crates were trustworthy, likely to be maintained, etc. Blessed definitely isn't supposed to be a list of every crate in a category. It attempts to be somewhat opinionated in order to help readers make decisions. Having said that, if there are libraries with different trade offs and no clear winner, then there also doesn't need to be strictly one options listed. It seems to me that it would reasonable for blessed's recommendation to be something like Crate X if you need windows console compatibility, otherwise Crate Y. |
colored-rs/colored (https://lib.rs/crates/colored) seems like it would a better fit to recommend for colouring text on a terminal than termcolor. It has 3.5x the GitHub stars of termcolor as of this issue. I think that both should be recommended or that colored should replace termcolor. The linked page for termcolor on lib.rs has also been removed.
I initially came across colored myself from this stackoverflow answer that recommends it.
The text was updated successfully, but these errors were encountered: