pub struct TextStyle {
pub text_color: Option<Color>,
pub background_color: Option<Color>,
pub is_bold: bool,
pub is_faint: bool,
pub is_italic: bool,
pub is_underlined: bool,
pub is_strikethrough: bool,
}Expand description
A type that described how text will be rendered.
Note: TextStyle uses ANSI escape codes, so it should not be used
anywhere they are not supported. Support for individual fields may also vary
by terminal.
Fields§
§text_color: Option<Color>The text color. None will not apply any color
background_color: Option<Color>The background color. None will not apply any background color.
is_bold: boolWhether the text is bold. (Might be rendered as increased intensity.)
is_faint: boolWhether the text has decreased intensity.
is_italic: boolWhether the text is italicised.
is_underlined: boolWhether the text is underlined.
is_strikethrough: boolWhether the text is crossed-out.
Implementations§
Source§impl TextStyle
impl TextStyle
Sourcepub fn apply(&self, string: &str) -> String
pub fn apply(&self, string: &str) -> String
Applies the style to a string.
apply() should not be called unless you are
manually implementing DisplayTree. It is used in derived
DisplayTree implementations.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TextStyle
impl RefUnwindSafe for TextStyle
impl Send for TextStyle
impl Sync for TextStyle
impl Unpin for TextStyle
impl UnwindSafe for TextStyle
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