pub struct Theme {
pub name: String,
pub default: Style,
pub styles: BTreeMap<String, Style>,
pub rainbow: Vec<Color>,
pub line_highlight: Style,
}Expand description
Default styles, capture styles, bracket colors, and line emphasis.
Fields§
§name: StringDisplay name from the theme source.
default: StyleBase style inherited by tokens.
styles: BTreeMap<String, Style>Capture styles keyed by dotted query capture names.
rainbow: Vec<Color>Bracket colors cycled by nesting depth. An empty palette disables bracket coloring.
line_highlight: StyleStyle applied to selected lines by a renderer.
Implementations§
Source§impl Theme
impl Theme
Sourcepub fn style(&self, capture: &str) -> Style
pub fn style(&self, capture: &str) -> Style
Combine the default style with styles matching the capture name and its prefixes.
More specific styles override colors and underlines when those values are set. Each matching style replaces the modifier list, including an empty list. Leading dots are ignored when building prefixes. Empty prefixes still match the empty style key. Only the final modifier list is cloned.
§Examples
use comfit_core::{Color, Style, Theme};
let mut theme = Theme::default();
theme.styles.insert("function".into(), Style {
fg: Some(Color::Indexed(4)),
..Style::default()
});
// A more specific capture inherits matching prefix styles.
assert_eq!(theme.style("function.call").fg, Some(Color::Indexed(4)));Trait Implementations§
Auto Trait Implementations§
impl Forget for Theme
impl Freeze for Theme
impl Move 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