[ANN] termcolor 1.0 is out and moved to its own repository


termcolor is a cross platform library for writing colored text to terminals and is used by ripgrep and Cargo (and rustc?). It sacrifices some of the ergonomics found in other coloring libraries in exchange for supporting efficient multi-threaded printing and Windows console coloring. (On Windows 10, termcolor will automatically use and enable ANSI coloring if possible.)

termcolor 1.0 is a mostly uninteresting release, and users of termcolor 0.3 should be able to migrate to termcolor 1.0 without making any changes. termcolor 1.0 brings one minor addition in the form of efficient single threaded buffered writing. termcolor 1.0 retains a minimum supported Rust version of 1.20.

I’ve released 1.0 because termcolor’s API has been stable for quite some time, and also because some new crates as part of the libripgrep effort will be getting released soon, and termcolor will be a public dependency of at least one of them. Finally, at this time, I don’t have any big changes or additions in mind. A small change for the future might perhaps include conforming to a yet-to-be-agreed-upon way of enabling/disabling colors across an entire application. (See: https://github.com/rust-lang-nursery/cli-wg/issues/15)

Note that termcolor is one point on the design spectrum for handling terminal colors. There are other possible designs, including, but not limited to, an ANSI interpreter that is active on Windows consoles (that don’t support ANSI escapes) for presenting a more unified/ergonomic cross platform interface. I don’t anticipate exploring this design space with termcolor, but others are encouraged to do so in other crates.

Repo: https://github.com/BurntSushi/termcolor

Docs: https://docs.rs/termcolor/1.0.0/termcolor/


Congrats on bringing a very useful cross-platform dependency to stable! :tada:
I’ve repeatedly discovered that terminal colouring is waaaay harder than it has any right to be, so I am always impressed if people get all the cross-platform idiosyncrasies ironed out. :bowing_man:

In general, it amazes me how much work you have put into ripgrep, and I keep being impressed by your continued refactorings to make it even more modular and useful.

(Just last Monday, a colleague of mine reduced a 160 minute git grep as part of a repo conversion to a 36 minute rg, within a day after me mentioning ripgrep to him. Yay for parallel searching and intuitive interfaces! :heart:)


Thanks for the kind words!

That’s incredible and actually kind of unexpected! git grep uses parallelism as well. That’s either one really big repository or a very resource constrained machine. :slight_smile:

Unexpectedly good ripgrep performance vs. git grep

It would be nice if termcolor did support NO_COLOR (http://no-color.org/), either directly or by some best-practice example code.