aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAkshay <[email protected]>2021-01-25 09:51:36 +0000
committerAkshay <[email protected]>2021-01-25 09:51:36 +0000
commitc26de6fbfd55cca906b9c184621a9f550cdcc0f1 (patch)
treec607cd0e5ba3d371a4d4529a76dde3305c3a8807 /src
parent85670bd3c1297053592c8c2863185bda681d5185 (diff)
attempt to style cursor
Diffstat (limited to 'src')
-rw-r--r--src/theme.rs5
-rw-r--r--src/views.rs8
2 files changed, 8 insertions, 5 deletions
diff --git a/src/theme.rs b/src/theme.rs
index 7ee65a1..e373b72 100644
--- a/src/theme.rs
+++ b/src/theme.rs
@@ -25,9 +25,10 @@ pub fn theme_gen() -> Theme {
25 return t; 25 return t;
26} 26}
27 27
28pub fn cursor_gen() -> Style { 28pub fn cursor_gen(foreground: Style) -> Style {
29 Style::from(ColorStyle::new( 29 Style::from(ColorStyle::new(
30 Light(cursive::theme::BaseColor::Blue),
31 TerminalDefault, 30 TerminalDefault,
31 Light(cursive::theme::BaseColor::Blue),
32 )) 32 ))
33 .combine(foreground)
33} 34}
diff --git a/src/views.rs b/src/views.rs
index 4f78ca2..a0beb2c 100644
--- a/src/views.rs
+++ b/src/views.rs
@@ -44,7 +44,6 @@ where
44 let todo_style = Style::from(CONFIGURATION.todo_color()); 44 let todo_style = Style::from(CONFIGURATION.todo_color());
45 let future_style = Style::from(CONFIGURATION.inactive_color()); 45 let future_style = Style::from(CONFIGURATION.inactive_color());
46 46
47 let cursor_style = cursor_gen();
48 let strikethrough = Style::from(Effect::Strikethrough); 47 let strikethrough = Style::from(Effect::Strikethrough);
49 48
50 let goal_status = is_today && self.reached_goal(Local::now().naive_local().date()); 49 let goal_status = is_today && self.reached_goal(Local::now().naive_local().date());
@@ -113,9 +112,12 @@ where
113 let draw_day = |printer: &Printer| { 112 let draw_day = |printer: &Printer| {
114 let mut i = 0; 113 let mut i = 0;
115 while let Some(d) = NaiveDate::from_ymd_opt(year, month, i + 1) { 114 while let Some(d) = NaiveDate::from_ymd_opt(year, month, i + 1) {
116 let mut day_style = cursor_style.combine(todo_style); 115 let mut day_style = todo_style;
117 if self.reached_goal(d) { 116 if self.reached_goal(d) {
118 day_style = day_style.combine(goal_reached_style); 117 day_style = goal_reached_style;
118 }
119 if d == now && printer.focused {
120 day_style = day_style.combine(cursor_gen(day_style));
119 } 121 }
120 let coords: Vec2 = ((i % 7) * 3, i / 7 + 2).into(); 122 let coords: Vec2 = ((i % 7) * 3, i / 7 + 2).into();
121 if let Some(c) = self.get_by_date(d) { 123 if let Some(c) = self.get_by_date(d) {