8 stable releases
1.0.7 | Jun 4, 2025 |
---|---|
1.0.6 | Oct 24, 2024 |
1.0.5 | Jul 25, 2024 |
1.0.4 | May 2, 2024 |
1.0.0 | Apr 13, 2023 |
#1316 in Command-line interface
25,037 downloads per month
Used in 13 crates
(12 directly)
21KB
129 lines
Mixin a clap argument for colored output selection
Examples
To get --color
through your entire program, just flatten
Color
and use it to configure your formatter:
use clap::Parser;
use owo_colors::OwoColorize as _;
/// Le CLI
#[derive(Debug, Parser)]
struct Cli {
#[command(flatten)]
color: colorchoice_clap::Color,
}
let cli = Cli::parse();
cli.color.write_global();
anstream::println!("Hello, {}!", "world".red());
colorchoice-clap
Convenience helper for working with
clap
to override console colors
License
Licensed under either of
- Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Contribute
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual-licensed as above, without any additional terms or conditions.
Dependencies
~1.2–1.8MB
~33K SLoC