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

Download history 10482/week @ 2025-03-22 5939/week @ 2025-03-29 5153/week @ 2025-04-05 4257/week @ 2025-04-12 4217/week @ 2025-04-19 4661/week @ 2025-04-26 4552/week @ 2025-05-03 5164/week @ 2025-05-10 6132/week @ 2025-05-17 4543/week @ 2025-05-24 5993/week @ 2025-05-31 5677/week @ 2025-06-07 6017/week @ 2025-06-14 6424/week @ 2025-06-21 6418/week @ 2025-06-28 5272/week @ 2025-07-05

25,037 downloads per month
Used in 13 crates (12 directly)

MIT/Apache

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

Documentation License Crates Status

License

Licensed under either of

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