4 stable releases

1.0.3 Sep 28, 2023
1.0.2 Aug 23, 2023
1.0.1 Jun 20, 2023
1.0.0 Apr 13, 2023

#857 in Command-line interface

Download history 2403/week @ 2023-12-11 2353/week @ 2023-12-18 2231/week @ 2023-12-25 2191/week @ 2024-01-01 2746/week @ 2024-01-08 1837/week @ 2024-01-15 1690/week @ 2024-01-22 2490/week @ 2024-01-29 3120/week @ 2024-02-05 2984/week @ 2024-02-12 1599/week @ 2024-02-19 2624/week @ 2024-02-26 2702/week @ 2024-03-04 2252/week @ 2024-03-11 5416/week @ 2024-03-18 5325/week @ 2024-03-25

15,906 downloads per month
Used in 6 crates

MIT/Apache

14KB
118 lines

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


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.4–2MB
~37K SLoC