pub struct Styles { /* private fields */ }
Expand description
Terminal styling definitions
See also Command::styles
.
§Example
clap v3 styling
let styles = Styles::styled()
.header(AnsiColor::Yellow.on_default())
.usage(AnsiColor::Green.on_default())
.literal(AnsiColor::Green.on_default())
.placeholder(AnsiColor::Green.on_default());
Implementations§
Source§impl Styles
impl Styles
Sourcepub const fn header(self, style: Style) -> Styles
pub const fn header(self, style: Style) -> Styles
General Heading style, e.g. help_heading
Sourcepub const fn placeholder(self, style: Style) -> Styles
pub const fn placeholder(self, style: Style) -> Styles
Descriptions within command-line syntax, e.g. value_name
Sourcepub const fn context(self, style: Style) -> Styles
pub const fn context(self, style: Style) -> Styles
Highlight all specified contexts, e.g. [default: false]
To specialize the style of the value within the context, see Styles::context_value
Sourcepub const fn context_value(self, style: Style) -> Styles
pub const fn context_value(self, style: Style) -> Styles
Highlight values within all of the context, e.g. the false
in [default: false]
If not explicitly set, falls back to context
’s style.
Source§impl Styles
Reflection
impl Styles
Reflection
Sourcepub const fn get_header(&self) -> &Style
pub const fn get_header(&self) -> &Style
General Heading style, e.g. help_heading
Sourcepub const fn get_literal(&self) -> &Style
pub const fn get_literal(&self) -> &Style
Literal command-line syntax, e.g. --help
Sourcepub const fn get_placeholder(&self) -> &Style
pub const fn get_placeholder(&self) -> &Style
Descriptions within command-line syntax, e.g. value_name
Sourcepub const fn get_invalid(&self) -> &Style
pub const fn get_invalid(&self) -> &Style
Highlight invalid usage
Sourcepub const fn get_context(&self) -> &Style
pub const fn get_context(&self) -> &Style
Highlight all specified contexts, e.g. [default: false]
To specialize the style of the value within the context, see Styles::context_value
Sourcepub const fn get_context_value(&self) -> &Style
pub const fn get_context_value(&self) -> &Style
Highlight values within all of the context, e.g. the false
in [default: false]
If not explicitly set, falls back to context
’s style.