7 stable releases

1.0.6 Oct 24, 2024
1.0.5 Jul 25, 2024
1.0.4 May 2, 2024
1.0.3 Sep 28, 2023
1.0.0 Apr 13, 2023

#1393 in Command-line interface

Download history 4674/week @ 2025-01-04 4310/week @ 2025-01-11 3711/week @ 2025-01-18 3888/week @ 2025-01-25 5066/week @ 2025-02-01 4892/week @ 2025-02-08 5796/week @ 2025-02-15 7591/week @ 2025-02-22 8594/week @ 2025-03-01 9713/week @ 2025-03-08 10019/week @ 2025-03-15 10482/week @ 2025-03-22 5939/week @ 2025-03-29 5153/week @ 2025-04-05 4257/week @ 2025-04-12 3381/week @ 2025-04-19

20,105 downloads per month
Used in 11 crates

MIT/Apache

18KB
126 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

Contribute

License

Dual-licensed under MIT or Apache 2.0

Dependencies

~1.2–1.8MB
~33K SLoC