4 stable releases
new 1.0.3 | Sep 28, 2023 |
---|---|
1.0.2 | Aug 23, 2023 |
1.0.1 | Jun 20, 2023 |
1.0.0 | Apr 13, 2023 |
#7 in #cli-color
8,411 downloads per month
Used in 7 crates
14KB
118 lines
colorchoice-clap
Convenience helper for working with
clap
to override console colors
Contribute
License
Dual-licensed under MIT or Apache 2.0
lib.rs
:
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());
Dependencies
~1.5–2MB
~38K SLoC