pub struct Style {
pub foreground: Option<Color>,
pub background: Option<Color>,
pub bold: bool,
pub dim: bool,
pub italic: bool,
pub underline: bool,
pub blink: bool,
pub reverse: bool,
pub hidden: bool,
pub strikethrough: bool,
}Expand description
Style attributes for text.
Fields§
§foreground: Option<Color>Foreground color
background: Option<Color>Background color
bold: boolBold text
dim: boolDim/faint text
italic: boolItalic text
underline: boolUnderlined text
blink: boolBlinking text
reverse: boolReversed colors (fg/bg swapped)
Hidden/invisible text
strikethrough: boolStrikethrough text
Implementations§
Source§impl Style
impl Style
Sourcepub fn foreground(self, color: Color) -> Self
pub fn foreground(self, color: Color) -> Self
Set the foreground color.
Sourcepub fn background(self, color: Color) -> Self
pub fn background(self, color: Color) -> Self
Set the background color.
Sourcepub fn fg(self, color: Color) -> Self
pub fn fg(self, color: Color) -> Self
Set the foreground color (alias for consistency with Rich).
Sourcepub fn bg(self, color: Color) -> Self
pub fn bg(self, color: Color) -> Self
Set the background color (alias for consistency with Rich).
Enable hidden/invisible.
Sourcepub fn strikethrough(self) -> Self
pub fn strikethrough(self) -> Self
Enable strikethrough.
Sourcepub fn combine(&self, other: &Style) -> Style
pub fn combine(&self, other: &Style) -> Style
Combine this style with another, with other taking precedence.
Sourcepub fn parse(s: &str) -> Self
pub fn parse(s: &str) -> Self
Parse a style from a string.
Supports space-separated attributes: “bold red on blue”
Sourcepub fn to_crossterm_attributes(&self) -> Attributes
pub fn to_crossterm_attributes(&self) -> Attributes
Apply this style to crossterm for rendering.
Trait Implementations§
impl Copy for Style
impl Eq for Style
impl StructuralPartialEq for Style
Auto Trait Implementations§
impl Freeze for Style
impl RefUnwindSafe for Style
impl Send for Style
impl Sync for Style
impl Unpin for Style
impl UnwindSafe for Style
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