Trait term_painter::ToStyle
[−]
[src]
pub trait ToStyle: Sized { fn to_style(self) -> Style; fn fg(self, c: Color) -> Style { ... } fn bg(self, c: Color) -> Style { ... } fn bold(self) -> Style { ... } fn dim(self) -> Style { ... } fn underline(self) -> Style { ... } fn not_underline(self) -> Style { ... } fn blink(self) -> Style { ... } fn reverse(self) -> Style { ... } fn secure(self) -> Style { ... } fn paint<T>(&self, obj: T) -> Painted<T> where Self: Clone { ... } fn with<F, R>(&self, f: F) -> R where F: FnOnce() -> R, Self: Clone { ... } }
Everything that can be seen as part of a style. This is the core of this crate. All functions ("style modifier") consume self and return a modified version of the style.
Required Methods
Provided Methods
fn fg(self, c: Color) -> Style
Sets the foreground (text) color.
fn bg(self, c: Color) -> Style
Sets the background color.
fn bold(self) -> Style
Makes the text bold.
fn dim(self) -> Style
Dim mode.
fn underline(self) -> Style
Underlines the text.
fn not_underline(self) -> Style
Removes underline-attribute.
fn blink(self) -> Style
Underlines the text.
fn reverse(self) -> Style
Underlines the text.
fn secure(self) -> Style
Secure mode.
fn paint<T>(&self, obj: T) -> Painted<T> where Self: Clone
Wraps the style specified in self
and something of arbitrary type
into a Painted
. When Painted
is printed it will print the arbitrary
something with the given style.
fn with<F, R>(&self, f: F) -> R where F: FnOnce() -> R, Self: Clone
Executes the given function, applying the style information before calling it and resetting after it finished.