Skip to main content

help_styles

Function help_styles 

Source
pub fn help_styles(mode: ColorMode) -> Styles
Expand description

The palette clap paints a help page with, in the roles HW-DR-0045 names.

§Why the base is Styles::plain() rather than clap’s own default

Styles::styled() is bold and underline over nine roles, and HW-DR-0045 rules on three: a section heading is default bold, a file path or a flag name is cyan, a verb name is green bold. Starting from plain and setting only what the decision names keeps the help screen on the same palette as headwater check, headwater sweep report and headwater explain, which is what the decision asks for in those words.

§The one judgment the palette does not settle

clap paints a flag name and a subcommand name with a single literal style, where HW-DR-0045 gives them cyan and green bold. Cyan wins here, because a verb page is mostly flags and a subcommand name appears on the root screen and the four taxonomy-shaped pages alone. Those verb names are painted green by hand in first_screen, where the layout is this crate’s own, so the decision is kept on the surface that shows the most of them.

§Why error, invalid and valid stay plain

clap writes a parse refusal to standard error and renders it with these same styles, while the choice above is read off standard output. A run with a terminal on one stream and a pipe on the other would then color a refusal nobody asked to be colored. err in main.rs already colors every refusal this binary composes, off stderr_color, which is the stream that answers for it.