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() -> Self
pub fn empty() -> Self
Style with no fg/bg/modifiers – the renderer’s “use my
existing style.” Equivalent to ratatui::Style::default()
or ratatui::Style::new().