pub struct Style {
pub fg: Color,
pub bg: Color,
pub modifiers: Modifier,
}Expand description
Style lets you control the main characteristics of displayed elements.
Includes foreground color, background color, and text modifiers.
Fields§
§fg: ColorThe foreground color.
bg: ColorThe background color.
modifiers: ModifierThe text modifiers (bold, italic, etc.)
Implementations§
Source§impl Style
impl Style
Sourcepub fn underlined(self) -> Self
pub fn underlined(self) -> Self
Adds the UNDERLINED modifier.
Sourcepub fn add_modifier(self, modifier: Modifier) -> Self
pub fn add_modifier(self, modifier: Modifier) -> Self
Adds a modifier.
Sourcepub fn remove_modifier(self, modifier: Modifier) -> Self
pub fn remove_modifier(self, modifier: Modifier) -> Self
Removes a modifier.
Sourcepub fn to_ansi_string(&self) -> String
pub fn to_ansi_string(&self) -> String
Converts this style to an ANSI escape sequence string.
Returns an empty string if the style has no changes (all defaults). The returned string includes the escape sequence prefix but not the reset.
Sourcepub fn reset_ansi() -> String
pub fn reset_ansi() -> String
Returns the ANSI reset escape sequence.
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.