Skip to main content

load_theme_context

Function load_theme_context 

Source
pub fn load_theme_context(
    project_dir: &Path,
) -> Result<Option<ThemeContext>, ThemeLoadError>
Expand description

Discover and load theme.dampen from a project directory.

This function looks for src/ui/theme/theme.dampen in the given project directory and loads it if found.

Note: The initial theme is set to the document’s default_theme. System theme preference will be applied reactively via the watch_system_theme() subscription once the application starts.

§Arguments

  • project_dir - The root directory of the Dampen project

§Returns

  • Ok(Some(ThemeContext)) - If a valid theme file was found and loaded
  • Ok(None) - If no theme file was found (use default Iced theme)
  • Err(_) - If a theme file exists but couldn’t be parsed