pub struct Style { /* private fields */ }Expand description
A terminal style.
Supports foreground color, background color, attributes, and an optional
hyperlink. Attributes use a three-state system: set to true, set to
false, or not set (None).
Implementations§
Source§impl Style
impl Style
Sourcepub fn underline2(self, value: bool) -> Self
pub fn underline2(self, value: bool) -> Self
Builder: set double underline.
Sourcepub fn without_color(&self) -> Self
pub fn without_color(&self) -> Self
Return a copy with foreground and background colors stripped.
Sourcepub fn background_style(&self) -> Self
pub fn background_style(&self) -> Self
Return a style with the background color set to the foreground color, useful for background-only rendering.
Sourcepub fn transparent_background(&self) -> bool
pub fn transparent_background(&self) -> bool
Returns true if the background is not set (transparent).
Sourcepub fn from_str(definition: &str) -> Self
pub fn from_str(definition: &str) -> Self
Builder: set style from a string (e.g. “bold red on blue”).
Sourcepub fn is_plain(&self) -> bool
pub fn is_plain(&self) -> bool
Returns true if this style has no colors, attributes, or link set.
Sourcepub fn combine(&self, other: &Style) -> Style
pub fn combine(&self, other: &Style) -> Style
Merge two styles: self is the base, other overrides.
Sourcepub fn reset_ansi(&self) -> &'static str
pub fn reset_ansi(&self) -> &'static str
Return the ANSI reset sequence needed to turn off this style.
Trait Implementations§
impl Eq 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 UnsafeUnpin 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.