pub trait Catalog {
type Class<'a>;
// Required methods
fn default<'a>() -> Self::Class<'a>;
fn style(&self, class: &Self::Class<'_>) -> Style;
}Expand description
The theme catalog of a code editor.
Implemented for iced::Theme out of the box, following the same catalog
pattern Iced’s own widgets use. Implement it for a custom theme type to
make this editor themable alongside the rest of an application.
§Examples
use iced_code_editor::theme::{Catalog, Style};
// `iced::Theme` implements `Catalog`, so a style comes from the theme
// itself rather than being hardcoded.
let class = <iced::Theme as Catalog>::default();
let style: Style = Catalog::style(&iced::Theme::Dracula, &class);
// A dark theme yields a dark editor background.
assert!(style.background.r < 0.5);Required Associated Types§
Required Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".