pub struct DiffTheme { /* private fields */ }Expand description
A capture-based syntax theme plus semantic colors for the diff UI.
Implementations§
Source§impl DiffTheme
impl DiffTheme
Sourcepub fn builder(id: impl Into<String>) -> SyntaxThemeBuilder
pub fn builder(id: impl Into<String>) -> SyntaxThemeBuilder
Starts a builder for a host-provided syntax theme.
Sourcepub fn from_bytes(id: ThemeId, bytes: &[u8]) -> Result<Self, ThemeError>
pub fn from_bytes(id: ThemeId, bytes: &[u8]) -> Result<Self, ThemeError>
Parses a versioned Diff theme JSON document.
Capture lookup first tries an exact name and then progressively removes dot-separated suffixes. The full parsed palette and map affect revision.
§Errors
Returns an error for malformed JSON or an unsupported schema version.
pub const fn id(&self) -> &ThemeId
pub const fn palette(&self) -> &DiffPalette
pub const fn revision(&self) -> Fingerprint
Sourcepub fn style(&self, capture: &str) -> Option<SyntaxStyle>
pub fn style(&self, capture: &str) -> Option<SyntaxStyle>
Resolves an exact capture or its nearest dot-separated parent.
Sourcepub fn catalog() -> Vec<ThemeDescriptor>
pub fn catalog() -> Vec<ThemeDescriptor>
Returns all selectable built-in themes, with stable kebab-case identifiers.
Sourcepub fn builtin(name: &str) -> Result<Self, ThemeError>
pub fn builtin(name: &str) -> Result<Self, ThemeError>
Loads a selectable built-in theme by its stable identifier.
Aliases are matched case-insensitively and with spaces or underscores normalized to dashes.
§Errors
Returns an error when no built-in theme has the supplied identifier.
Sourcepub fn sage() -> Result<Self, ThemeError>
pub fn sage() -> Result<Self, ThemeError>
Sourcepub fn ayu() -> Result<Self, ThemeError>
pub fn ayu() -> Result<Self, ThemeError>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DiffTheme
impl RefUnwindSafe for DiffTheme
impl Send for DiffTheme
impl Sync for DiffTheme
impl Unpin for DiffTheme
impl UnsafeUnpin for DiffTheme
impl UnwindSafe for DiffTheme
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