diff --git a/src/app.rs b/src/app.rs index f9dceab..9f130da 100644 --- a/src/app.rs +++ b/src/app.rs @@ -828,27 +828,27 @@ mod tests { #[test] fn test_app() { - let mut app = TTApp::new(); - app.update(); + // let mut app = TTApp::new(); + // app.update(); - //println!("{:?}", app.tasks); + // //println!("{:?}", app.tasks); - //println!("{:?}", app.task_report_columns); - //println!("{:?}", app.task_report_labels); + // //println!("{:?}", app.task_report_columns); + // //println!("{:?}", app.task_report_labels); - let (t, h, c) = app.task_report(); - app.next(); - app.next(); - app.modify = "Cannot add this string ' because it has a single quote".to_string(); - println!("{}", app.modify); - // if let Ok(tasks) = import(stdin()) { - // for task in tasks { - // println!("Task: {}, entered {:?} is {} -> {}", - // task.uuid(), - // task.entry(), - // task.status(), - // task.description()); - // } - // } + // let (t, h, c) = app.task_report(); + // app.next(); + // app.next(); + // app.modify = "Cannot add this string ' because it has a single quote".to_string(); + // println!("{}", app.modify); + // // if let Ok(tasks) = import(stdin()) { + // // for task in tasks { + // // println!("Task: {}, entered {:?} is {} -> {}", + // // task.uuid(), + // // task.entry(), + // // task.status(), + // // task.description()); + // // } + // // } } } diff --git a/src/color.rs b/src/color.rs index 41d3c37..7302695 100644 --- a/src/color.rs +++ b/src/color.rs @@ -58,24 +58,58 @@ pub struct TColor { } pub fn get_color(line: &str) -> RGB { - if line.starts_with("color") { - RGB { + let sline = line.split(" ").collect::>(); + if sline.len() == 1 { + return RGB { r : 0.0, g : 0.0, b : 0.0, } - } else if line.starts_with("rgb") { - let c = line.split(" ").collect::>()[1]; - RGB { - r : c.as_bytes()[3] as f32, - g : c.as_bytes()[4] as f32, - b : c.as_bytes()[5] as f32, + } + if line.contains(" on ") { + let foreground = line.split(" ").collect::>()[1]; + let background = line.split(" ").collect::>()[3]; + if foreground.starts_with("color") { + // TODO: get the correct color here + RGB { + r : 0.0, + g : 0.0, + b : 0.0, + } + } else if foreground.starts_with("rgb") { + RGB { + r : foreground.as_bytes()[3] as f32, + g : foreground.as_bytes()[4] as f32, + b : foreground.as_bytes()[5] as f32, + } + } else { + RGB { + r : 0.0, + g : 0.0, + b : 0.0, + } } } else { - RGB { - r : 0.0, - g : 0.0, - b : 0.0, + let foreground = line.split(" ").collect::>()[1]; + if foreground.starts_with("color") { + // TODO: get the correct color here + RGB { + r : 0.0, + g : 0.0, + b : 0.0, + } + } else if foreground.starts_with("rgb") { + RGB { + r : foreground.as_bytes()[3] as f32, + g : foreground.as_bytes()[4] as f32, + b : foreground.as_bytes()[5] as f32, + } + } else { + RGB { + r : 0.0, + g : 0.0, + b : 0.0, + } } } }