pub struct Style(/* private fields */);Expand description
Text styling attributes including foreground color, background color, and modifiers.
Combines colors and text modifiers (bold, italic, etc.) into a single value.
Use with_fg, with_bg, and
with_modifier to build styles.
§Examples
use extui::{Style, Color, vt::Modifier};
let style = Style::DEFAULT
.with_fg(Color::Red1)
.with_bg(Color::Black)
.with_modifier(Modifier::BOLD);Implementations§
Source§impl Style
impl Style
Sourcepub const fn delta(self) -> StyleDelta
pub const fn delta(self) -> StyleDelta
Creates a StyleDelta for transitioning to this style.
Sourcepub const fn with_fg(self, color: Color) -> Style
pub const fn with_fg(self, color: Color) -> Style
Returns a new style with the given foreground color.
Sourcepub const fn without_fg(self) -> Style
pub const fn without_fg(self) -> Style
Returns a new style without a foreground color.
Sourcepub const fn without_bg(self) -> Style
pub const fn without_bg(self) -> Style
Returns a new style without a background color.
Sourcepub const fn with_modifier(self, mods: Modifier) -> Style
pub const fn with_modifier(self, mods: Modifier) -> Style
Returns a new style with the given modifiers added.
Sourcepub const fn without_modifier(self, mods: Modifier) -> Style
pub const fn without_modifier(self, mods: Modifier) -> Style
Returns a new style with the given modifiers removed.
Trait Implementations§
Source§impl BitOrAssign<Modifier> for Style
impl BitOrAssign<Modifier> for Style
Source§fn bitor_assign(&mut self, rhs: Modifier)
fn bitor_assign(&mut self, rhs: Modifier)
Performs the
|= operation. Read moreSource§impl BitOrAssign for Style
impl BitOrAssign for Style
Source§fn bitor_assign(&mut self, rhs: Self)
fn bitor_assign(&mut self, rhs: Self)
Performs the
|= operation. Read moreSource§impl BufferWrite for Style
impl BufferWrite for Style
Source§fn write_to_buffer(&self, buffer: &mut Vec<u8>)
fn write_to_buffer(&self, buffer: &mut Vec<u8>)
Appends the VT sequence bytes to the buffer.
Source§impl RenderProperty for Style
impl RenderProperty for Style
Source§fn apply(self, properties: &mut RenderProperties)
fn apply(self, properties: &mut RenderProperties)
Applies this property to the given render properties.
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