From c26de6fbfd55cca906b9c184621a9f550cdcc0f1 Mon Sep 17 00:00:00 2001 From: Akshay Date: Mon, 25 Jan 2021 15:21:36 +0530 Subject: attempt to style cursor --- src/theme.rs | 5 +++-- src/views.rs | 8 +++++--- 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 { return t; } -pub fn cursor_gen() -> Style { +pub fn cursor_gen(foreground: Style) -> Style { Style::from(ColorStyle::new( - Light(cursive::theme::BaseColor::Blue), TerminalDefault, + Light(cursive::theme::BaseColor::Blue), )) + .combine(foreground) } 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 let todo_style = Style::from(CONFIGURATION.todo_color()); let future_style = Style::from(CONFIGURATION.inactive_color()); - let cursor_style = cursor_gen(); let strikethrough = Style::from(Effect::Strikethrough); let goal_status = is_today && self.reached_goal(Local::now().naive_local().date()); @@ -113,9 +112,12 @@ where let draw_day = |printer: &Printer| { let mut i = 0; while let Some(d) = NaiveDate::from_ymd_opt(year, month, i + 1) { - let mut day_style = cursor_style.combine(todo_style); + let mut day_style = todo_style; if self.reached_goal(d) { - day_style = day_style.combine(goal_reached_style); + day_style = goal_reached_style; + } + if d == now && printer.focused { + day_style = day_style.combine(cursor_gen(day_style)); } let coords: Vec2 = ((i % 7) * 3, i / 7 + 2).into(); if let Some(c) = self.get_by_date(d) { -- cgit v1.2.3