@@ -366,29 +366,39 @@ impl Application {
366 self.editor.refresh_config();
366 self.editor.refresh_config();
369− fn refresh_config(&mut self) {
369+ /// Refresh theme after config change
370− let config = Config::load_default().unwrap_or_else(|err| {
370+ fn refresh_theme(&mut self, config: &Config) {
371− self.editor.set_error(err.to_string());
376 if let Some(theme) = config.theme.clone() {
371 if let Some(theme) = config.theme.clone() {
377 let true_color = self.true_color();
372 let true_color = self.true_color();
378− self.editor.set_theme(
379− self.theme_loader
373+ match self.theme_loader.load(&theme) {
380− .load(&theme)
374+ Ok(theme) => {
381− .map_err(|e| {
375+ if true_color || theme.is_16_color() {
376+ self.editor.set_theme(theme);
379+ .set_error("theme requires truecolor support, which is not available");
382− log::warn!("failed to load theme `{}` - {}", theme, e);
383+ let err_string = format!("failed to load theme `{}` - {}", theme, err);
383− e
384+ self.editor.set_error(err_string);
386− .filter(|theme| (true_color || theme.is_16_color()))
387− .unwrap_or_else(|| self.theme_loader.default_theme(true_color)),
390+ fn refresh_config(&mut self) {
391+ match Config::load_default() {
393+ self.refresh_theme(&config);
391− self.config.store(Arc::new(config));
396+ self.config.store(Arc::new(config));
399+ self.editor.set_error(err.to_string());
394 fn true_color(&self) -> bool {
404 fn true_color(&self) -> bool {