pub struct Theme {
pub name: String,
/* private fields */
}Expand description
A syntax highlighting theme.
Themes map capture names (like “keyword”, “string”, “comment”) to styles.
Fields§
§name: StringTheme name
Implementations§
Source§impl Theme
impl Theme
Sourcepub fn from_toml(toml_str: &str) -> Result<Self, ThemeError>
pub fn from_toml(toml_str: &str) -> Result<Self, ThemeError>
Parse a theme from TOML string.
Sourcepub fn from_toml_with_name(
toml_str: &str,
name: &str,
) -> Result<Self, ThemeError>
pub fn from_toml_with_name( toml_str: &str, name: &str, ) -> Result<Self, ThemeError>
Parse a theme from TOML string with a name.
Sourcepub fn from_file(path: &Path) -> Result<Self, ThemeError>
pub fn from_file(path: &Path) -> Result<Self, ThemeError>
Load a theme from a TOML file.
Sourcepub fn style_for(&self, capture: &str) -> RatatuiStyle
pub fn style_for(&self, capture: &str) -> RatatuiStyle
Get the ratatui style for a capture name.
Uses hierarchical fallback: “keyword.control” falls back to “keyword”.
Sourcepub fn capture_names(&self) -> Vec<&str>
pub fn capture_names(&self) -> Vec<&str>
Get the list of all capture names this theme defines styles for.
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
Converts
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>
Converts
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