pub struct Theme { /* private fields */ }Expand description
Resolved highlight-group → style map. Theme is materialized state:
every group has its final Style baked in. Construct via
smelt_tui::theme::compile or hand-build with Theme::set.
Implementations§
Source§impl Theme
impl Theme
pub fn new() -> Theme
Sourcepub fn set(&mut self, name: impl Into<String>, style: Style)
pub fn set(&mut self, name: impl Into<String>, style: Style)
Set name to style. Overwrites any prior value.
Sourcepub fn get(&self, name: &str) -> Style
pub fn get(&self, name: &str) -> Style
Resolve a name to its current Style. Unknown names return Style::default().
Sourcepub fn resolve(&self, hl: HlGroup) -> Style
pub fn resolve(&self, hl: HlGroup) -> Style
Resolve a HlGroup to its current Style. Anonymous style ids fall
through to the global anon registry; everything else returns
Style::default().
Sourcepub fn contains(&self, hl: HlGroup) -> bool
pub fn contains(&self, hl: HlGroup) -> bool
True iff this Theme has a Style registered for hl. False means
resolve will fall back to the anon registry or Style::default().
pub fn is_light(&self) -> bool
pub fn set_light(&mut self, light: bool)
Sourcepub fn iter(&self) -> impl Iterator<Item = (HlGroup, &Style)>
pub fn iter(&self) -> impl Iterator<Item = (HlGroup, &Style)>
Iterator over (HlGroup, &Style) for every group set on this theme.
Order is unspecified.
pub fn is_empty(&self) -> bool
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Theme
impl RefUnwindSafe for Theme
impl Send for Theme
impl Sync for Theme
impl Unpin for Theme
impl UnsafeUnpin for Theme
impl UnwindSafe for Theme
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