Skip to main content

load_theme_str

Function load_theme_str 

Source
pub fn load_theme_str(text: &str, base: Theme) -> Result<Theme, ThemeError>
Expand description

Load a theme from TOML text, filling anything absent from base.

Inheritance is what makes a theme file worth hand-writing: a user who wants a different accent colour writes three lines, not forty. base is typically glass_default.

§Errors

ThemeError::Syntax if the text is not TOML, ThemeError::WrongType if a field holds the wrong kind of value, and ThemeError::BadColor if a colour is not #RRGGBB or #RRGGBBAA — each naming the field, since a theme file has forty of them and a caller cannot bisect a hand-written one.