pub struct Theme {
pub name: String,
pub is_dark: bool,
pub background: Option<Color>,
pub foreground: Option<Color>,
/* private fields */
}Expand description
A complete syntax highlighting theme.
Fields§
§name: StringTheme name for display.
is_dark: boolWhether this is a dark or light theme.
background: Option<Color>Background color for the code block.
foreground: Option<Color>Foreground (default text) color.
Implementations§
Source§impl Theme
impl Theme
Sourcepub const ANSI_RESET: &'static str = "\x1b[0m"
pub const ANSI_RESET: &'static str = "\x1b[0m"
ANSI reset sequence.
Sourcepub fn from_toml(toml_str: &str) -> Result<Self, ThemeError>
pub fn from_toml(toml_str: &str) -> Result<Self, ThemeError>
Parse a theme from Helix-style TOML.
Sourcepub fn to_css(&self, selector_prefix: &str) -> String
pub fn to_css(&self, selector_prefix: &str) -> String
Generate CSS for this theme.
Uses CSS nesting for compact output. The selector_prefix is prepended
to scope the rules (e.g., [data-theme="mocha"]).
Sourcepub fn ansi_style(&self, index: usize) -> String
pub fn ansi_style(&self, index: usize) -> String
Generate ANSI escape sequence for a style.
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 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