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 plain() -> Styles
Available on crate feature unstable-styles only.
pub const fn plain() -> Styles
unstable-styles only.No terminal styling
sourcepub const fn styled() -> Styles
Available on crate feature unstable-styles only.
pub const fn styled() -> Styles
unstable-styles only.Default terminal styling
sourcepub const fn header(self, style: Style) -> Styles
Available on crate feature unstable-styles only.
pub const fn header(self, style: Style) -> Styles
unstable-styles only.General Heading style, e.g. help_heading
sourcepub const fn error(self, style: Style) -> Styles
Available on crate feature unstable-styles only.
pub const fn error(self, style: Style) -> Styles
unstable-styles only.Error heading
sourcepub const fn usage(self, style: Style) -> Styles
Available on crate feature unstable-styles only.
pub const fn usage(self, style: Style) -> Styles
unstable-styles only.Usage heading
sourcepub const fn literal(self, style: Style) -> Styles
Available on crate feature unstable-styles only.
pub const fn literal(self, style: Style) -> Styles
unstable-styles only.Literal command-line syntax, e.g. --help
sourcepub const fn placeholder(self, style: Style) -> Styles
Available on crate feature unstable-styles only.
pub const fn placeholder(self, style: Style) -> Styles
unstable-styles only.Descriptions within command-line syntax, e.g. value_name
source§impl Styles
impl Styles
Reflection
sourcepub const fn get_header(&self) -> &Style
Available on crate feature unstable-styles only.
pub const fn get_header(&self) -> &Style
unstable-styles only.General Heading style, e.g. help_heading
sourcepub const fn get_error(&self) -> &Style
Available on crate feature unstable-styles only.
pub const fn get_error(&self) -> &Style
unstable-styles only.Error heading
sourcepub const fn get_usage(&self) -> &Style
Available on crate feature unstable-styles only.
pub const fn get_usage(&self) -> &Style
unstable-styles only.Usage heading
sourcepub const fn get_literal(&self) -> &Style
Available on crate feature unstable-styles only.
pub const fn get_literal(&self) -> &Style
unstable-styles only.Literal command-line syntax, e.g. --help
sourcepub const fn get_placeholder(&self) -> &Style
Available on crate feature unstable-styles only.
pub const fn get_placeholder(&self) -> &Style
unstable-styles only.Descriptions within command-line syntax, e.g. value_name
sourcepub const fn get_valid(&self) -> &Style
Available on crate feature unstable-styles only.
pub const fn get_valid(&self) -> &Style
unstable-styles only.Highlight suggested usage
sourcepub const fn get_invalid(&self) -> &Style
Available on crate feature unstable-styles only.
pub const fn get_invalid(&self) -> &Style
unstable-styles only.Highlight invalid usage
Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for Styles
impl Send for Styles
impl Sync for Styles
impl Unpin for Styles
impl UnwindSafe for Styles
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more