pub struct Theme {
pub css: String,
pub templates: ThemeTemplates,
}Expand description
A loaded theme: CSS tokens and optional intent template overrides.
Two construction paths:
Theme::default_theme()— always available, embedded at compile time.Theme::from_path()— loads from a filesystem directory.
Fields§
§css: StringCSS content using Tailwind v4 @theme syntax.
templates: ThemeTemplatesOptional intent template overrides; all-None means built-in layouts apply.
Implementations§
Source§impl Theme
impl Theme
Sourcepub fn default_theme() -> Self
pub fn default_theme() -> Self
Returns the embedded default theme.
The CSS uses Tailwind v4 @theme with 23 semantic token slots (light + dark).
Templates are all-None — built-in intent layouts apply unchanged.
Sourcepub fn from_path(path: &str) -> Result<Self, ThemeError>
pub fn from_path(path: &str) -> Result<Self, ThemeError>
Loads a theme from a directory on the filesystem.
Expects tokens.css to exist in the directory.
theme.json is optional — if absent, templates default to empty (ThemeTemplates::default()).
§Errors
ThemeError::NotFound— directory does not exist.ThemeError::Io—tokens.csscannot be read.ThemeError::Json—theme.jsonexists but cannot be parsed.
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