1 use std::io; 2 3 use crossterm::style::Color; 4 5 use super::style::StyleManager; 6 7 pub mod event; 8 pub mod mode; 9 pub mod uicore; 10 11 #[derive(Debug)] 12 pub struct AppInfo { 13 pub level: InfoLevel, 14 pub info: String, 15 } 16 17 impl AppInfo { reset(&mut self)18 pub fn reset(&mut self) { 19 self.level = InfoLevel::Info; 20 self.info = String::new(); 21 } 22 } 23 24 #[allow(dead_code)] 25 #[derive(Debug)] 26 pub enum InfoLevel { 27 Info, 28 Warn, 29 Error, 30 } 31 32 impl InfoLevel { set_style(&self) -> io::Result<()>33 pub fn set_style(&self) -> io::Result<()> { 34 match self { 35 InfoLevel::Info => {} 36 InfoLevel::Warn => { 37 StyleManager::set_background_color(Color::DarkYellow)?; 38 } 39 InfoLevel::Error => { 40 StyleManager::set_background_color(Color::DarkRed)?; 41 } 42 } 43 44 Ok(()) 45 } 46 } 47