pub struct Style {
pub fg: Option<Color>,
pub bg: Option<Color>,
pub modifiers: Modifiers,
pub scale: Option<FontScale>,
pub family: Option<FamilyId>,
pub weight: Option<Weight>,
}Expand description
A single style: optional foreground + optional background +
modifiers (bold/italic/etc) + the rich-vocabulary attributes
(scale / family / weight). None for fg/bg means “do not
set this channel” (matches ratatui’s empty-style semantics and
GPUI’s Style::transparent_black background semantics).
Eq + Hash is load-bearing: the host folds a content-hash of the
Theme into [lattice_cells::MatrixVersion::theme] so a palette
change rebuilds the cell matrix. Every field must therefore be
Hash — which is why the rich-vocabulary attributes use
fixed-point / enum / interned-id representations
(FontScale is u16 hundredths, not f32) rather than the
f32 an authoring StyleSpec carries (T.2 resolves the ratio to
fixed-point here).
Fields§
§fg: Option<Color>§bg: Option<Color>§modifiers: Modifiers§scale: Option<FontScale>Relative height multiplier (emacs :height float, quantized
to fixed-point). None ⇒ 1.0×. Honored by the GPUI peer’s
per-run font shaping (T.10); a no-op on the fixed-grid TUI.
family: Option<FamilyId>Font family selector. None ⇒ the buffer’s default family.
Honored by GPUI; a no-op on the TUI (single grid font).
weight: Option<Weight>Font weight, finer than the bold modifier. None ⇒
inherit/default. Honored by GPUI; the TUI maps any
bold-or-heavier weight to its bold attribute.
Implementations§
Source§impl Style
impl Style
Sourcepub fn empty() -> Style
pub fn empty() -> Style
Style with no fg/bg/modifiers – the renderer’s “use my
existing style.” Equivalent to ratatui::Style::default()
or ratatui::Style::new().
pub fn fg(self, color: Color) -> Style
pub fn bg(self, color: Color) -> Style
pub fn bold(self) -> Style
pub fn italic(self) -> Style
pub fn underline(self) -> Style
pub fn dim(self) -> Style
pub fn reverse(self) -> Style
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 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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more