pub struct StyleSpec {
pub inherit: Option<ElementName>,
pub fg: Option<ColorRef>,
pub bg: Option<ColorRef>,
pub modifiers: ModifierSet,
pub scale: Option<f32>,
pub family: Option<FamilyId>,
pub weight: Option<Weight>,
}Expand description
How an element is styled, by reference. The form a mode default,
a theme override, or a buffer-local remap is written in.
Resolution (crate::registry) produces a concrete
Style.
Fields§
§inherit: Option<ElementName>Inherit another element’s resolved style; this spec’s set fields override. Resolved by walking the chain at build time.
fg: Option<ColorRef>§bg: Option<ColorRef>§modifiers: ModifierSet§scale: Option<f32>Relative height ratio (emacs :height float). Resolution
quantizes to fixed-point FontScale.
family: Option<FamilyId>§weight: Option<Weight>Implementations§
Source§impl StyleSpec
impl StyleSpec
Sourcepub fn new() -> Self
pub fn new() -> Self
An empty spec — resolves to Style::empty() (or the inherit
base) with no overrides.
Sourcepub fn inherit(self, name: impl Into<ElementName>) -> Self
pub fn inherit(self, name: impl Into<ElementName>) -> Self
Inherit another element’s resolved style.
Sourcepub fn fg(self, fg: impl Into<ColorRef>) -> Self
pub fn fg(self, fg: impl Into<ColorRef>) -> Self
Set the foreground by reference (palette key, literal, or
default). Accepts a PaletteKey, a Color, or a ColorRef.
pub fn bold(self) -> Self
pub fn italic(self) -> Self
pub fn underline(self) -> Self
pub fn dim(self) -> Self
pub fn reverse(self) -> Self
pub fn family(self, family: FamilyId) -> Self
pub fn weight(self, weight: Weight) -> Self
Trait Implementations§
impl StructuralPartialEq for StyleSpec
Auto Trait Implementations§
impl Freeze for StyleSpec
impl RefUnwindSafe for StyleSpec
impl Send for StyleSpec
impl Sync for StyleSpec
impl Unpin for StyleSpec
impl UnsafeUnpin for StyleSpec
impl UnwindSafe for StyleSpec
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