Skip to main content

load_theme_context_with_preference

Function load_theme_context_with_preference 

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

Discover and load theme.dampen with an optional system preference.

This variant allows passing a pre-detected system preference for cases where it’s already known (e.g., from a previous theme change event).

§Arguments

  • project_dir - The root directory of the Dampen project
  • system_preference - Optional system theme preference (“light” or “dark”)

§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