Implements a new function, config::load_theme()
, that looks up the user-specified color choice (eg color="always"
) and returns a theme based on that preference.
FVQYZQFL7WHSC3UUPJ4IWTP7SKTDQ4K6K5HY4EDK3JKXG3CQNZEAC
ZSFJT4SFIAS7WBODRZOFKKG4SVYBC5PC6XY75WYN7CCQ3SMV7IUQC
CCLLB7OIFNFYJZTG3UCI7536TOCWSCSXR67VELSB466R24WLJSDAC
L4JXJHWXYNCL4QGJXNKKTOKKTAXKKXBJUUY7HFZGEUZ5A2V5H34QC
SXEYMYF7P4RZMZ46WPL4IZUTSQ2ATBWYZX7QNVMS3SGOYXYOHAGQC
EEBKW7VTILH6AGGV57ZIJ3DJGYHDSYBWGU3C7Q4WWAKSVNUGIYMQC
A3RM526Y7LUXNYW4TL56YKQ5GVOK2R5D7JJVTSQ6TT5MEXIR6YAAC
TFPETWTVADLG2DL7WERHJPGMJVOY4WOKCRWB3NZ3YOOQ4CVAUHBAC
}
}
/// Choose the right dialoguer theme based on user's config
pub fn load_theme() -> Result<Box<dyn theme::Theme>, anyhow::Error> {
if let Ok((config, _)) = Global::load() {
let color_choice = config.colors.unwrap_or_default();
match color_choice {
Choice::Auto | Choice::Always => Ok(Box::new(theme::ColorfulTheme::default())),
Choice::Never => Ok(Box::new(theme::SimpleTheme)),
}
} else {
Ok(Box::new(theme::ColorfulTheme::default()))